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");
85 public function handle(array $record)
87 if ($this->processors) {
88 foreach ($this->processors as $processor) {
89 $record = call_user_func($processor, $record);
93 if ($this->buffering) {
94 $this->buffer[] = $record;
95 if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
96 array_shift($this->buffer);
98 if ($this->activationStrategy->isHandlerActivated($record)) {
99 if ($this->stopBuffering) {
100 $this->buffering =
false;
103 $this->handler = call_user_func($this->handler, $record, $this);
104 if (!$this->handler instanceof HandlerInterface) {
105 throw new \RuntimeException(
"The factory callable should return a HandlerInterface");
108 $this->handler->handleBatch($this->buffer);
109 $this->buffer = array();
112 $this->handler->handle($record);
123 if (null !== $this->passthruLevel) {
125 $this->buffer = array_filter($this->buffer,
function ($record) use (
$level) {
126 return $record[
'level'] >=
$level;
128 if (count($this->buffer) > 0) {
129 $this->handler->handleBatch($this->buffer);
130 $this->buffer = array();
140 $this->buffering =
true;
150 $this->buffer = array();
Base Handler class providing the Handler structure.
Buffers all records until a certain level is reached.
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.
reset()
Resets the state of the handler.
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.