\Monolog\HandlerFingersCrossedHandler

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 find the various activation strategies in the Monolog\Handler\FingersCrossed\ namespace.

Summary

Methods
Properties
Constants
__construct()
isHandling()
handleBatch()
close()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
setLevel()
getLevel()
setBubble()
getBubble()
__destruct()
activate()
handle()
reset()
clear()
No public properties found
No constants found
getDefaultFormatter()
$level
$bubble
$formatter
$processors
$handler
$activationStrategy
$buffering
$bufferSize
$buffer
$stopBuffering
$passthruLevel
N/A
No private methods found
No private properties found
N/A

Properties

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$handler

$handler : 

Type

$activationStrategy

$activationStrategy : 

Type

$buffering

$buffering : 

Type

$bufferSize

$bufferSize : 

Type

$buffer

$buffer : 

Type

$stopBuffering

$stopBuffering : 

Type

$passthruLevel

$passthruLevel : 

Type

Methods

__construct()

__construct(callable|\Monolog\Handler\HandlerInterface  $handler, integer|\Monolog\Handler\FingersCrossed\ActivationStrategyInterface  $activationStrategy = null, integer  $bufferSize, Boolean  $bubble = true, Boolean  $stopBuffering = true, integer  $passthruLevel = null) 

Parameters

callable|\Monolog\Handler\HandlerInterface $handler

Handler or factory callable($record, $fingersCrossedHandler).

integer|\Monolog\Handler\FingersCrossed\ActivationStrategyInterface $activationStrategy

Strategy which determines when this handler takes action

integer $bufferSize

How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.

Boolean $bubble

Whether the messages that are handled can bubble up the stack or not

Boolean $stopBuffering

Whether the handler should stop buffering after being triggered (default true)

integer $passthruLevel

Minimum level to always flush to handler on close, even if strategy not triggered

isHandling()

isHandling(array  $record) : Boolean

Checks whether the given record will be handled by this handler.

This is mostly done for performance reasons, to avoid calling processors for nothing.

Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.

Parameters

array $record

Partial log record containing only a level key

Returns

Boolean

handleBatch()

handleBatch(array  $records) 

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() 

Closes the handler.

This will be called automatically when the object is destroyed

pushProcessor()

pushProcessor(callable  $callback) : self

Adds a processor in the stack.

Parameters

callable $callback

Returns

self

popProcessor()

popProcessor() : callable

Removes the processor on top of the stack and returns it.

Returns

callable

setLevel()

setLevel(integer|string  $level) : self

Sets minimum logging level at which this handler will be triggered.

Parameters

integer|string $level

Level or level name

Returns

self

getLevel()

getLevel() : integer

Gets minimum logging level at which this handler will be triggered.

Returns

integer

setBubble()

setBubble(Boolean  $bubble) : self

Sets the bubbling behavior.

Parameters

Boolean $bubble

true means that this handler allows bubbling. false means that bubbling is not permitted.

Returns

self

getBubble()

getBubble() : Boolean

Gets the bubbling behavior.

Returns

Boolean —

true means that this handler allows bubbling. false means that bubbling is not permitted.

__destruct()

__destruct() 

activate()

activate() 

Manually activate this logger regardless of the activation strategy

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

reset()

reset() 

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

clear()

clear() 

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

It also resets the handler to its initial buffering state.