Buffers all records until a certain level is reached

The advantage of this approach is that you don't get any clutter in your log files.
Only requests which actually trigger an error (or whatever your actionLevel is) will be
in the logs, but they will contain all records, not only those above the level threshold.

You can then have a passthruLevel as well which means that at the end of the request,
even if it did not get activated, it will still send through log records of e.g. at least a
warning level.

You can find the various activation strategies in the
Monolog\Handler\FingersCrossed\ namespace.

CloneableInstantiable
ExtendsMonolog\Handler\Handler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public __construct( $handler, $activationStrategy = NULL, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, $passthruLevel = NULL)
 
  • psalm-param HandlerInterface|callable(?array, FingersCrossedHandler): HandlerInterface $handler
public Monolog\Handler\Handler::__destruct()
public Monolog\Handler\Handler::__sleep()
public activate() : void
 

Manually activate this logger regardless of the activation strategy

public clear() : void
 

Clears the buffer without flushing any messages down to the wrapped handler.

It also resets the handler to its initial buffering state.

public close() : void
 

{@inheritdoc}

public getFormatter() : Monolog\Formatter\FormatterInterface
 

{@inheritdoc}

public getHandler(?array $record = NULL)
 

Return the nested handler

If the handler was provided as a factory callable, this will trigger the handler's instantiation.

public handle(array $record) : bool
 

{@inheritdoc}

public Monolog\Handler\Handler::handleBatch(array $records) : void
 

{@inheritdoc}

public isHandling(array $record) : bool
 

{@inheritdoc}

public popProcessor() : callable
 

{@inheritdoc}

public pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface
 

{@inheritdoc}

  • suppress PhanTypeMismatchReturn
public reset()
public setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface
 

{@inheritdoc}

Properties
protected $activationStrategy
protected $bubble
protected $buffer
protected $buffering
protected $bufferSize
protected $handler
protected $passthruLevel
protected $processors
 
  • var callable[]
protected $stopBuffering
Methods
protected processRecord(array $record) : array
 

Processes a record.

protected resetProcessors() : void
Methods
private flushBuffer() : void
 

Resets the state of the handler. Stops forwarding records to the wrapped handler.

© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only