Skip to content

LogEventListenerProvider

github-actions edited this page Apr 6, 2026 · 1 revision

Log every dispatched object through a PSR-3 logger.


Methods

__construct

Create a listener that records dispatched events.

public __construct(\Psr\Log\LoggerInterface $logger, string $level = \Psr\Log\LogLevel::INFO): mixed

Parameters:

Parameter Type Description
$logger \Psr\Log\LoggerInterface logger used to record the event
$level string PSR-3 log level

__invoke

Log the provided event.

public __invoke(object $event): void

Parameters:

Parameter Type Description
$event object event emitted by the dispatcher

Inherited methods

__invoke

Handle the provided event.

public __invoke(object $event): void
  • This method is abstract. Parameters:
Parameter Type Description
$event object event emitted by the dispatcher

getListenersForEvent

Yield the current listener for any dispatched object.

final public getListenersForEvent(object $event): iterable<callable>
  • This method is final. Parameters:
Parameter Type Description
$event object event being dispatched

Return Value:

matching listeners


Clone this wiki locally