69 if (!$this->handler instanceof
HandlerInterface && !is_callable($this->handler)) {
70 throw new \RuntimeException(
"The given handler (".json_encode($this->handler).
") is not a callable nor a Monolog\Handler\HandlerInterface object");
87 if ($this->stopBuffering) {
88 $this->buffering =
false;
91 $record = end($this->buffer) ?:
null;
93 $this->handler = call_user_func($this->handler, $record, $this);
95 throw new \RuntimeException(
"The factory callable should return a HandlerInterface");
98 $this->handler->handleBatch($this->buffer);
99 $this->buffer = array();
107 if ($this->processors) {
108 foreach ($this->processors as $processor) {
109 $record = call_user_func($processor, $record);
113 if ($this->buffering) {
114 $this->buffer[] = $record;
115 if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
116 array_shift($this->buffer);
118 if ($this->activationStrategy->isHandlerActivated($record)) {
122 $this->handler->handle($record);
133 if (
null !== $this->passthruLevel) {
135 $this->buffer = array_filter($this->buffer,
function ($record) use (
$level) {
136 return $record[
'level'] >=
$level;
138 if (count($this->buffer) > 0) {
139 $this->handler->handleBatch($this->buffer);
140 $this->buffer = array();
150 $this->buffering =
true;
160 $this->buffer = array();
An exception for terminatinating execution or to throw for unit testing.
Base Handler class providing the Handler structure.
Buffers all records until a certain level is reached.
isHandling(array $record)
{{Checks whether the given record will be handled by this handler.This is mostly done for performance...
clear()
Clears the buffer without flushing any messages down to the wrapped handler.
__construct($handler, $activationStrategy=null, $bufferSize=0, $bubble=true, $stopBuffering=true, $passthruLevel=null)
reset()
Resets the state of the handler.
handle(array $record)
{Handles a record.All records may be passed to this method, and the handler should discard those that...
close()
{Closes the handler.This will be called automatically when the object is destroyed}
activate()
Manually activate this logger regardless of the activation strategy.
Error level based activation strategy.
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
const WARNING
Exceptional occurrences that are not errors.
Interface for activation strategies for the FingersCrossedHandler.
Interface that all Monolog Handlers must implement.