70 if (!$this->handler instanceof
HandlerInterface && !is_callable($this->handler)) {
71 throw new \RuntimeException(
"The given handler (".json_encode($this->handler).
") is not a callable nor a Monolog\Handler\HandlerInterface object");
88 if ($this->stopBuffering) {
89 $this->buffering =
false;
92 $record = end($this->buffer) ?: null;
94 $this->handler = call_user_func($this->handler, $record, $this);
95 if (!$this->handler instanceof HandlerInterface) {
96 throw new \RuntimeException(
"The factory callable should return a HandlerInterface");
99 $this->handler->handleBatch($this->buffer);
100 $this->buffer = array();
108 if ($this->processors) {
109 foreach ($this->processors as $processor) {
110 $record = call_user_func($processor, $record);
114 if ($this->buffering) {
115 $this->buffer[] = $record;
116 if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
117 array_shift($this->buffer);
119 if ($this->activationStrategy->isHandlerActivated($record)) {
123 $this->handler->handle($record);
144 $this->handler->reset();
155 $this->buffer = array();
164 if (null !== $this->passthruLevel) {
166 $this->buffer = array_filter($this->buffer,
function ($record) use (
$level) {
167 return $record[
'level'] >=
$level;
169 if (count($this->buffer) > 0) {
170 $this->handler->handleBatch($this->buffer);
174 $this->buffer = array();
175 $this->buffering =
true;
activate()
Manually activate this logger regardless of the activation strategy.
Base Handler class providing the Handler structure.
flushBuffer()
Resets the state of the handler.
Buffers all records until a certain level is reached.
Handler or Processor implementing this interface will be reset when Logger::reset() is called...
Error level based activation strategy.
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.
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Interface for activation strategies for the FingersCrossedHandler.
const WARNING
Exceptional occurrences that are not errors.
handle(array $record)
{Handles a record.All records may be passed to this method, and the handler should discard those that...
__construct($handler, $activationStrategy=null, $bufferSize=0, $bubble=true, $stopBuffering=true, $passthruLevel=null)
Interface that all Monolog Handlers must implement.