LoggerChannel
class LoggerChannel implements LoggerChannelInterface (View source)
Defines a logger channel that most implementations will use.
Traits
Constants
| MAX_CALL_DEPTH |
Maximum call depth to self::log() for a single log message. It's very easy for logging channel code to call out to other library code that will create log messages. In that case, we will recurse back in to LoggerChannel::log() multiple times while processing a single originating message. To prevent infinite recursion, we track the call depth and bail out at LoggerChannel::MAX_CALL_DEPTH iterations. |
Properties
| protected int | $callDepth | Number of times LoggerChannel::log() has been called for a single message. |
|
| protected string | $channel | The name of the channel of this logger instance. |
|
| protected array | $levelTranslation | Map of PSR3 log constants to RFC 5424 log constants. |
|
| protected array | $loggers | An array of arrays of \Psr\Log\LoggerInterface keyed by priority. |
|
| protected RequestStack | $requestStack | The request stack object. |
|
| protected AccountInterface | $currentUser | The current user object. |
Methods
Constructs a LoggerChannel object.
{@inheritdoc}
Sets the request stack.
Sets the loggers for this channel.
Adds a logger.
Sorts loggers according to priority.
Details
__construct(string $channel)
Constructs a LoggerChannel object.
log($level, $message, array $context = [])
{@inheritdoc}
setRequestStack(RequestStack $requestStack = NULL)
Sets the request stack.
setCurrentUser(AccountInterface $current_user = NULL)
Sets the current user.
setLoggers(array $loggers)
Sets the loggers for this channel.
addLogger(LoggerInterface $logger, int $priority = 0)
Adds a logger.
protected array
sortLoggers()
Sorts loggers according to priority.