$handler
$handler :
Simple handler wrapper that deduplicates log records across multiple requests
It also includes the BufferHandler functionality and will buffer all messages until the end of the request or flush() is called.
This works by storing all log records' messages above $deduplicationLevel to the file specified by $deduplicationStore. When further logs come in at the end of the request (or when flush() is called), all those above $deduplicationLevel are checked against the existing stored logs. If they match and the timestamps in the stored log is not older than $time seconds, the new log record is discarded. If no log record is new, the whole data set is discarded.
This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers that send messages to people, to avoid spamming with the same message over and over in case of a major component failure like a database server being down which makes all requests fail in the same way.
$formatter : \Monolog\Formatter\FormatterInterface
__construct(\Monolog\Handler\HandlerInterface $handler, string $deduplicationStore = null, integer $deduplicationLevel = \Monolog\Logger::ERROR, integer $time = 60, Boolean $bubble = true)
\Monolog\Handler\HandlerInterface | $handler | Handler. |
string | $deduplicationStore | The file/path where the deduplication log should be kept |
integer | $deduplicationLevel | The minimum logging level for log records to be looked at for deduplication purposes |
integer | $time | The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through |
Boolean | $bubble | Whether the messages that are handled can bubble up the stack or not |
isHandling(array $record) : Boolean
Checks whether the given record will be handled by this handler.
This is mostly done for performance reasons, to avoid calling processors for nothing.
Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
array | $record | Partial log record containing only a level key |
setFormatter(\Monolog\Formatter\FormatterInterface $formatter) : self
Sets the formatter.
\Monolog\Formatter\FormatterInterface | $formatter |
getFormatter() : \Monolog\Formatter\FormatterInterface
Gets the formatter.
getDefaultFormatter() : \Monolog\Formatter\FormatterInterface
Gets the default formatter.