\Monolog\HandlerHandlerWrapper

This simple wrapper class can be used to extend handlers functionality.

Example: A custom filtering that can be applied to any handler.

Inherit from this class and override handle() like this:

public function handle(array $record) { if ($record meets certain conditions) { return false; } return $this->handler->handle($record); }

Summary

Methods
Properties
Constants
__construct()
isHandling()
handle()
handleBatch()
close()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
reset()
No public properties found
No constants found
No protected methods found
$handler
N/A
No private methods found
No private properties found
N/A

Properties

$handler

$handler : \Monolog\Handler\HandlerInterface

Type

HandlerInterface

Methods

__construct()

__construct(\Monolog\Handler\HandlerInterface  $handler) : mixed

Parameters

\Monolog\Handler\HandlerInterface $handler

Returns

mixed —

isHandling()

isHandling(array  $record) : bool

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

Parameters

array $record

Partial log record containing only a level key

Returns

bool —

handle()

handle(array  $record) : bool

Handles a record.

Parameters

array $record

The record to handle

Returns

bool —

true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.

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

Closes the handler.

pushProcessor()

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

Adds a processor in the stack.

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

self

popProcessor()

popProcessor() : callable|\Monolog\Processor\ProcessorInterface

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

Returns

callable|\Monolog\Processor\ProcessorInterface —

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 —

reset()

reset() : void