Documentation

HandlerInterface

Interface that all Monolog Handlers must implement

Tags
author

Jordi Boggiano j.boggiano@seld.be

Table of Contents

Methods

getFormatter()  : FormatterInterface
Gets the formatter.
handle()  : bool
Handles a record.
handleBatch()  : mixed
Handles a set of records at once.
isHandling()  : bool
Checks whether the given record will be handled by this handler.
popProcessor()  : callable
Removes the processor on top of the stack and returns it.
pushProcessor()  : self
Adds a processor in the stack.
setFormatter()  : self
Sets the formatter.

Methods

handle()

Handles a record.

public handle(array<string|int, mixed> $record) : bool

All records may be passed to this method, and the handler should discard those that it does not want to handle.

The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.

Parameters
$record : array<string|int, mixed>

The record to handle

Return values
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()

Handles a set of records at once.

public handleBatch(array<string|int, mixed> $records) : mixed
Parameters
$records : array<string|int, mixed>

The records to handle (an array of record arrays)

isHandling()

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

public isHandling(array<string|int, mixed> $record) : bool

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
$record : array<string|int, mixed>

Partial log record containing only a level key

Return values
bool

popProcessor()

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

public popProcessor() : callable
Return values
callable

pushProcessor()

Adds a processor in the stack.

public pushProcessor(callable $callback) : self
Parameters
$callback : callable
Return values
self

        
On this page

Search results