$level
$level : int
Handler to only pass log messages when a certain threshold of number of messages is reached.
This can be useful in cases of processing a batch of data, but you're for example only interested in case it fails catastrophically instead of a warning for 1 or 2 events. Worse things can happen, right?
Usage example:
$log = new Logger('application');
$handler = new SomeHandler(...)
// Pass all warnings to the handler when more than 10 & all error messages when more then 5
$overflow = new OverflowHandler($handler, [Logger::WARNING => 10, Logger::ERROR => 5]);
$log->pushHandler($overflow);
$level : int
$bubble : bool
$handler : \Monolog\Handler\HandlerInterface
$thresholdMap : int[]
$buffer : array[]
Buffer of all messages passed to the handler before the threshold was reached
__construct(\Monolog\Handler\HandlerInterface $handler, int[] $thresholdMap = [], mixed $level = Logger::DEBUG, bool $bubble = true) : mixed
\Monolog\Handler\HandlerInterface | $handler | |
int[] | $thresholdMap | Dictionary of logger level => threshold |
mixed | $level | The minimum logging level at which this handler will be triggered |
bool | $bubble | Whether the messages that are handled can bubble up the stack or not |
handle(array $record) : bool
Handles a record.
All records may be passed to this method, and the handler should discard those that it does not want to handle.
The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.
{@inheritDoc}
array | $record |