PsrLoggerErrorReporter

Class
Read only: Yes Final: Yes

This error reporter implementation MUST log all reported exceptions using a PSR-3 compatible logger.

Description

It SHALL provide a detailed log message including the exception class, message, file, line, callback description, and arguments. This class MUST NOT throw exceptions during reporting.

Table of Contents

Interfaces

ErrorReporterInterface

This interface MUST be implemented by any class that reports exceptions from deferred callbacks.

Properties

 : LoggerInterface

Methods

__construct()

Constructs a new PsrLoggerErrorReporter instance.

 : mixed
report()

Reports a throwable using the PSR-3 logger.

 : void
Properties
Methods

__construct()

Public

Constructs a new PsrLoggerErrorReporter instance.

public __construct(LoggerInterface  $logger) : mixed
Parameters
$logger : LoggerInterface

Description

the PSR-3 logger to use for error reporting

report()

Public

Reports a throwable using the PSR-3 logger.

public report(Throwable  $throwable[, callable|null  $callback = null][, array<string|int, mixed>  $args = []]) : void

Description

This method MUST log the exception details and callback description. It MUST NOT throw exceptions.

Parameters
$throwable : Throwable

Description

the exception or error to report

$callback : callable|null = null

Description

the related callback, if available

$args : array<string|int, mixed> = []

Description

arguments passed to the callback, if any