1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

Add support for priority in the Monolog bundle (https://github.com/symfony/monolog-bundle/pull/455) (#1797)

Co-authored-by: Roy <rdmartines@vcn.nl>
This commit is contained in:
Roy
2023-06-20 16:37:16 +02:00
committed by GitHub
parent dc4bc7e660
commit 4356885fbb
2 changed files with 10 additions and 6 deletions

View File

@@ -26,11 +26,13 @@ class AsMonologProcessor
* @param string|null $channel The logging channel the processor should be pushed to.
* @param string|null $handler The handler the processor should be pushed to.
* @param string|null $method The method that processes the records (if the attribute is used at the class level).
* @param int|null $priority The priority of the processor so the order can be determined.
*/
public function __construct(
public readonly ?string $channel = null,
public readonly ?string $handler = null,
public readonly ?string $method = null
public readonly ?string $method = null,
public readonly ?int $priority = null
) {
}
}

View File

@@ -20,14 +20,16 @@ final class AsMonologProcessorTest extends TestCase
{
public function test(): void
{
$asMonologProcessor = new AsMonologProcessor('channel', 'handler', 'method');
$asMonologProcessor = new AsMonologProcessor('channel', 'handler', 'method', -10);
$this->assertSame('channel', $asMonologProcessor->channel);
$this->assertSame('handler', $asMonologProcessor->handler);
$this->assertSame('method', $asMonologProcessor->method);
$this->assertSame(-10, $asMonologProcessor->priority);
$asMonologProcessor = new AsMonologProcessor(null, null, null);
$asMonologProcessor = new AsMonologProcessor(null, null, null, null);
$this->assertNull($asMonologProcessor->channel);
$this->assertNull($asMonologProcessor->handler);
$this->assertNull($asMonologProcessor->method);
$this->assertNull($asMonologProcessor->priority);
}
}