friendica-addons/monolog/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php

47 lines
1.5 KiB
PHP
Raw Normal View History

2022-10-17 21:25:03 +02:00
<?php declare(strict_types=1);
/*
* This file is part of the Monolog package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Monolog\Attribute;
/**
* A reusable attribute to help configure a class or a method as a processor.
2023-01-18 00:17:49 +01:00
*
2022-10-17 21:25:03 +02:00
* Using it offers no guarantee: it needs to be leveraged by a Monolog third-party consumer.
2023-01-18 00:17:49 +01:00
*
2022-10-17 21:25:03 +02:00
* Using it with the Monolog library only has no effect at all: processors should still be turned into a callable if
* needed and manually pushed to the loggers and to the processable handlers.
*/
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class AsMonologProcessor
{
2023-01-18 00:17:49 +01:00
/** @var string|null */
public $channel = null;
/** @var string|null */
public $handler = null;
/** @var string|null */
public $method = null;
2022-10-17 21:25:03 +02:00
/**
2023-01-18 00:17:49 +01:00
* @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).
2022-10-17 21:25:03 +02:00
*/
public function __construct(
2023-01-18 00:17:49 +01:00
?string $channel = null,
?string $handler = null,
?string $method = null
2022-10-17 21:25:03 +02:00
) {
2023-01-18 00:17:49 +01:00
$this->channel = $channel;
$this->handler = $handler;
$this->method = $method;
2022-10-17 21:25:03 +02:00
}
2023-01-18 00:17:49 +01:00
}