\Monolog\HandlerBufferHandler

Buffers all records until closing the handler and then pass them as batch.

This is useful for a MailHandler to send only one mail per request instead of sending one per log message.

Summary

Methods
Properties
Constants
pushProcessor()
popProcessor()
__construct()
isHandling()
setLevel()
getLevel()
setBubble()
getBubble()
reset()
handleBatch()
close()
__destruct()
__sleep()
handle()
flush()
clear()
setFormatter()
getFormatter()
No public properties found
No constants found
processRecord()
resetProcessors()
$processors
$level
$bubble
$handler
$bufferSize
$bufferLimit
$flushOnOverflow
$buffer
$initialized
N/A
No private methods found
No private properties found
N/A

Properties

$processors

$processors : callable[]

Type

callable[]

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$handler

$handler : \Monolog\Handler\HandlerInterface

Type

HandlerInterface

$bufferSize

$bufferSize : int

Type

int

$bufferLimit

$bufferLimit : int

Type

int

$flushOnOverflow

$flushOnOverflow : bool

Type

bool

$buffer

$buffer : \Monolog\Handler\Record[]

Type

Record[]

$initialized

$initialized : bool

Type

bool

Methods

pushProcessor()

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

{@inheritDoc}

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

popProcessor()

popProcessor() : callable

{@inheritDoc}

Returns

callable —

__construct()

__construct(\Monolog\Handler\HandlerInterface  $handler, int  $bufferLimit, mixed  $level = Logger::DEBUG, bool  $bubble = true, bool  $flushOnOverflow = false) : mixed

Parameters

\Monolog\Handler\HandlerInterface $handler

Handler.

int $bufferLimit

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

mixed $level

The minimum logging level at which this handler will be triggered

bool $bubble

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

bool $flushOnOverflow

If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded

Returns

mixed —

isHandling()

isHandling(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

setLevel()

setLevel(mixed  $level) : self

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

Parameters

mixed $level

Returns

self —

getLevel()

getLevel() : int

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

Returns

int —

setBubble()

setBubble(bool  $bubble) : self

Sets the bubbling behavior.

Parameters

bool $bubble

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

Returns

self —

getBubble()

getBubble() : bool

Gets the bubbling behavior.

Returns

bool —

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

reset()

reset() : void

handleBatch()

handleBatch(array  $records) : void

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() : void

{@inheritDoc}

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

handle()

handle(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

flush()

flush() : void

clear()

clear() : void

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

setFormatter()

setFormatter(\Monolog\Formatter\FormatterInterface  $formatter) : \Monolog\Handler\HandlerInterface

Sets the formatter.

Parameters

\Monolog\Formatter\FormatterInterface $formatter

Returns

\Monolog\Handler\HandlerInterface —

self

getFormatter()

getFormatter() : \Monolog\Formatter\FormatterInterface

Gets the formatter.

Returns

\Monolog\Formatter\FormatterInterface —

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array —

resetProcessors()

resetProcessors() : void