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
Table of Contents
Interfaces
- HandlerInterface
- Interface that all Monolog Handlers must implement
- ResettableInterface
- Handler or Processor implementing this interface will be reset when Logger::reset() is called.
Properties
Methods
- __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
getFormatter()
Gets the formatter.
public
getFormatter() : FormatterInterface
Return values
FormatterInterfacehandle()
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)
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
boolpopProcessor()
Removes the processor on top of the stack and returns it.
public
popProcessor() : callable
Return values
callablepushProcessor()
Adds a processor in the stack.
public
pushProcessor(mixed $callback) : self
Parameters
- $callback : mixed
Return values
selfreset()
public
reset() : mixed
setFormatter()
Sets the formatter.
public
setFormatter(FormatterInterface $formatter) : self
Parameters
- $formatter : FormatterInterface