\Monolog\HandlerFilterHandler

Simple handler wrapper that filters records based on a list of levels

It can be configured with an exact list of levels to allow, or a min/max level.

Summary

Methods
Properties
Constants
pushProcessor()
popProcessor()
handleBatch()
close()
__destruct()
__sleep()
__construct()
getAcceptedLevels()
setAcceptedLevels()
isHandling()
handle()
getHandler()
setFormatter()
getFormatter()
reset()
No public properties found
No constants found
processRecord()
resetProcessors()
$processors
$handler
$acceptedLevels
$bubble
N/A
No private methods found
No private properties found
N/A

Properties

$processors

$processors : callable[]

Type

callable[]

$handler

$handler : callable|\Monolog\Handler\HandlerInterface

Handler or factory callable($record, $this)

Type

HandlerInterface

$acceptedLevels

$acceptedLevels : int[]

Minimum level for logs that are passed to handler

Type

int[]

$bubble

$bubble : bool

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

Type

bool

Methods

pushProcessor()

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

{@inheritDoc}

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

popProcessor()

popProcessor() : callable

{@inheritDoc}

Returns

callable —

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.

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

__construct()

__construct(callable|\Monolog\Handler\HandlerInterface  $handler, int|array  $minLevelOrList = Logger::DEBUG, int|string  $maxLevel = Logger::EMERGENCY, bool  $bubble = true) : mixed

Parameters

callable|\Monolog\Handler\HandlerInterface $handler

Handler or factory callable($record|null, $filterHandler).

int|array $minLevelOrList

A list of levels to accept or a minimum level if maxLevel is provided

int|string $maxLevel

Maximum level to accept, only used if $minLevelOrList is not an array

bool $bubble

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

Returns

mixed —

getAcceptedLevels()

getAcceptedLevels() : array

Returns

array —

setAcceptedLevels()

setAcceptedLevels(int|string|array  $minLevelOrList = Logger::DEBUG, int|string  $maxLevel = Logger::EMERGENCY) : self

Parameters

int|string|array $minLevelOrList

A list of levels to accept or a minimum level or level name if maxLevel is provided

int|string $maxLevel

Maximum level or level name to accept, only used if $minLevelOrList is not an array

Returns

self —

isHandling()

isHandling(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

handle()

handle(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

getHandler()

getHandler(array  $record = null) : \Monolog\Handler\HandlerInterface

Return the nested handler

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

Parameters

array $record

Returns

\Monolog\Handler\HandlerInterface —

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

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array —

resetProcessors()

resetProcessors() : void