Documentation

HandlerWrapper
in package
implements HandlerInterface, ProcessableHandlerInterface, FormattableHandlerInterface, ResettableInterface

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(LogRecord $record) { if ($record meets certain conditions) { return false; } return $this->handler->handle($record); }

Tags
author

Alexey Karapetov alexey@karapetov.com

Table of Contents

Interfaces

HandlerInterface
Interface that all Monolog Handlers must implement
ProcessableHandlerInterface
Interface to describe loggers that have processors
FormattableHandlerInterface
Interface to describe loggers that have a formatter
ResettableInterface
Handler or Processor implementing this interface will be reset when Logger::reset() is called.

Properties

$handler  : HandlerInterface

Methods

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

Properties

Methods

close()

Closes the handler.

public close() : void
Tags
inheritDoc

handle()

Handles a record.

public handle(LogRecord $record) : bool
Parameters
$record : LogRecord

The record to handle

Tags
inheritDoc
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) : void
Parameters
$records : array<string|int, mixed>

The records to handle

Tags
inheritDoc

isHandling()

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

public isHandling(LogRecord $record) : bool
Parameters
$record : LogRecord

Partial log record having only a level initialized

Tags
inheritDoc
Return values
bool
On this page

Search results