HandlerWrapper
in package
implements
HandlerInterface, 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(array $record) { if ($record meets certain conditions) { return false; } return $this->handler->handle($record); }
Tags
Interfaces, Classes and Traits
- HandlerInterface
- Interface that all Monolog Handlers must implement
- ResettableInterface
- Handler or Processor implementing this interface will be reset when Logger::reset() is called.
Table of Contents
- $handler : HandlerInterface
- __construct() : mixed
- HandlerWrapper constructor.
- 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.
- reset() : mixed
- setFormatter() : self
- Sets the formatter.
Properties
$handler
protected
HandlerInterface
$handler
Methods
__construct()
HandlerWrapper constructor.
public
__construct(HandlerInterface $handler) : mixed
Parameters
- $handler : HandlerInterface
Return values
mixed —getFormatter()
Gets the formatter.
public
getFormatter() : FormatterInterface
Return values
FormatterInterface —handle()
Handles a record.
public
handle(array<string|int, mixed> $record) : bool
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)
Return values
mixed —isHandling()
Checks whether the given record will be handled by this handler.
public
isHandling(array<string|int, mixed> $record) : bool
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(mixed $callback) : self
Parameters
- $callback : mixed
Return values
self —reset()
public
reset() : mixed
Return values
mixed —setFormatter()
Sets the formatter.
public
setFormatter(FormatterInterface $formatter) : self
Parameters
- $formatter : FormatterInterface