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:
@@ -26,11 +26,13 @@ class AsMonologProcessor
|
|||||||
* @param string|null $channel The logging channel the processor should be pushed to.
|
* @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 $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 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 function __construct(
|
||||||
public readonly ?string $channel = null,
|
public readonly ?string $channel = null,
|
||||||
public readonly ?string $handler = null,
|
public readonly ?string $handler = null,
|
||||||
public readonly ?string $method = null
|
public readonly ?string $method = null,
|
||||||
|
public readonly ?int $priority = null
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,14 +20,16 @@ final class AsMonologProcessorTest extends TestCase
|
|||||||
{
|
{
|
||||||
public function test(): void
|
public function test(): void
|
||||||
{
|
{
|
||||||
$asMonologProcessor = new AsMonologProcessor('channel', 'handler', 'method');
|
$asMonologProcessor = new AsMonologProcessor('channel', 'handler', 'method', -10);
|
||||||
$this->assertSame('channel', $asMonologProcessor->channel);
|
$this->assertSame('channel', $asMonologProcessor->channel);
|
||||||
$this->assertSame('handler', $asMonologProcessor->handler);
|
$this->assertSame('handler', $asMonologProcessor->handler);
|
||||||
$this->assertSame('method', $asMonologProcessor->method);
|
$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->channel);
|
||||||
$this->assertNull($asMonologProcessor->handler);
|
$this->assertNull($asMonologProcessor->handler);
|
||||||
$this->assertNull($asMonologProcessor->method);
|
$this->assertNull($asMonologProcessor->method);
|
||||||
|
$this->assertNull($asMonologProcessor->priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user