$level
$level :
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);
$handler : \Monolog\Handler\HandlerInterface
__construct(\Monolog\Handler\HandlerInterface $handler, array<mixed,integer> $thresholdMap = array(), integer|string $level = \Monolog\Logger::DEBUG, boolean $bubble = true)
| \Monolog\Handler\HandlerInterface | $handler | |
| array<mixed,integer> | $thresholdMap | Dictionary of logger level => threshold |
| integer|string | $level | The minimum logging level at which this handler will be triggered |
| boolean | $bubble | Whether the messages that are handled can bubble up the stack or not |
close()
Closes the handler.
Ends a log cycle and frees all resources used by the handler.
Closing a Handler means flushing all buffers and freeing any open resources/handles.
Implementations have to be idempotent (i.e. it should be possible to call close several times without breakage) and ideally handlers should be able to reopen themselves on handle() after they have been closed.
This is useful at the end of a request and will be called automatically when the object is destroyed if you extend Monolog\Handler\Handler.
If you are thinking of calling this method yourself, most likely you should be calling ResettableInterface::reset instead. Have a look.
handle(array $record) : Boolean
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.
| array | $record | The record to handle |
true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
setFormatter(\Monolog\Formatter\FormatterInterface $formatter) : \Monolog\Handler\HandlerInterface
Sets the formatter.
| \Monolog\Formatter\FormatterInterface | $formatter |
self
getFormatter() : \Monolog\Formatter\FormatterInterface
Gets the formatter.