Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Completly rewritten extension (#4)
Browse files Browse the repository at this point in the history
Rewritten extension from scratch
- Nette 3 only
  • Loading branch information
Radovan Kepák authored May 26, 2021
1 parent 29dc084 commit 69f9a44
Show file tree
Hide file tree
Showing 28 changed files with 326 additions and 263 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is Fork of [Kdyby/Monolog](https://github.com/kdyby/monolog), licensed unde
Installation
------------

The best way to install MG/Monolog is using [Composer](http://getcomposer.org/):
The best way to install Mallgroup/Monolog is using [Composer](http://getcomposer.org/):

```sh
$ composer require mallgroup/monolog
Expand Down
28 changes: 16 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,33 @@
],
"require": {
"php": ">=7.4 <8.1",
"nette/di": "^2.4.17 || ^3.0",
"nette/utils": "^2.5.7 || ^3.0",
"nette/di": "^3.0.5",
"nette/utils": "^3.0",
"monolog/monolog": "^2.2",
"tracy/tracy": "^2.6.8"
"nette/schema": "^1.2"
},
"require-dev": {
"nette/application": "^2.4.17 || ^3.0.7",
"nette/bootstrap": "^2.4.6 || ^3.0",
"nette/caching": "^2.5.9 || ^3.0",
"nette/http": "^2.4.12 || ^3.0",
"nette/application": "^3.0.7",
"nette/bootstrap": "^3.0",
"nette/caching": "^3.0",
"nette/http": "^3.0",
"nette/tester": "^2.4",
"psr/log": "^1.1",
"phpstan/phpstan": "^0.12.80",
"php-parallel-lint/php-parallel-lint": "^1.2"
"phpstan/phpstan-nette": "^0.12.15",
"php-parallel-lint/php-parallel-lint": "^1.2",
"tracy/tracy": "2.6"
},
"suggest": {
"tracy/tracy": "To set tracyHook and get Tracy blueScreen on exceptions"
},
"minimum-stability": "stable",
"support": {
"email": "[email protected]",
"issues": "https://github.com/MG/monolog/issues"
"issues": "https://github.com/mallgroup/monolog/issues"
},
"autoload": {
"psr-4": {
"MG\\Monolog\\": "src/"
"Mallgroup\\Monolog\\": "src/"
}
},
"autoload-dev": {
Expand All @@ -58,7 +62,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "2.0-dev"
}
},
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Integration of [Monolog](https://github.com/Seldaek/monolog) into Nette Framewor
Installation
------------

The best way to install MG/Monolog is using [Composer](http://getcomposer.org/):
The best way to install Mallgroup/Monolog is using [Composer](http://getcomposer.org/):

```sh
$ composer require mallgroup/monolog
Expand All @@ -17,7 +17,7 @@ and enable it in `config.neon`

```yml
extensions:
monolog: MG\Monolog\DI\MonologExtension
monolog: Mallgroup\Monolog\DI\MonologExtension
```


Expand Down Expand Up @@ -45,7 +45,7 @@ You can of course turn off the registration into Tracy

```yml
monolog:
hookToTracy: off
tracyHook: off
```

but then you have to handle the messages yourself and you're giving up the power of Monolog.
Expand Down Expand Up @@ -90,7 +90,7 @@ Processors are special type of class, that has to implement one method only - `_
They're called for every message, that is sent to Monolog so they can change it's contents.
When you're adding processor programatically in your application, you can also use closures.

MG\Monolog always registers it's custom `PriorityProcessor`, which has two tasks
Mallgroup\Monolog always registers it's custom `PriorityProcessor`, which has two tasks

- when message `context` contains `channel` name, change the real `channel` to that name and unset the value from `context`
- or, when the `context` has `priority` defined and the priority is standard name of record level (info, warning, error, ...) change the `channel` name to that
Expand Down Expand Up @@ -142,10 +142,10 @@ class EmailQueue
Let's change the signature a bit, so the autocompletion starts working as expected

```php
public function __construct(\Nette\Mail\IMailer $mailer, \MG\Monolog\Logger $logger)
public function __construct(\Nette\Mail\IMailer $mailer, \Mallgroup\Monolog\Logger $logger)
```

The custom logger in MG\Monolog only adds one new method `->channel($name)`, which is a factory for custom Logger with custom channel, that does nothing but proxy the messages to it's parent.
The custom logger in Mallgroup\Monolog only adds one new method `->channel($name)`, which is a factory for custom Logger with custom channel, that does nothing but proxy the messages to it's parent.

If we now use the factory instead of simply assigning the value

Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ parameters:

paths:
- src

stubFiles:
- stubs/DI/CompilerExtension.stub

includes:
- vendor/phpstan/phpstan-nette/extension.neon
4 changes: 2 additions & 2 deletions src/CustomChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* For the full copyright and license information, please view the file license.md that was distributed with this source code.
*/

namespace MG\Monolog;
namespace Mallgroup\Monolog;

use MG\Monolog\Logger as CustomLogger;
use Mallgroup\Monolog\Logger as CustomLogger;
use Monolog\Handler\HandlerInterface;
use Monolog\Logger as MonologLogger;
use Nette\SmartObject;
Expand Down
Loading

0 comments on commit 69f9a44

Please sign in to comment.