Monolog error handler

A facility to enable logging of runtime errors, exceptions and fatal errors.

Quick setup: ErrorHandler::register($logger);

CloneableInstantiable
Methods
public __construct(Psr\Log\LoggerInterface $logger)
public handleError( $code, $message, $file = '', $line = 0, $context = [])
 
  • private
public handleException( $e)
 
  • private
public handleFatalError()
 
  • private
public static register(Psr\Log\LoggerInterface $logger, $errorLevelMap = [], $exceptionLevelMap = [], $fatalLevel = NULL) : self
 

Registers a new ErrorHandler for a given Logger

By default it will handle errors, exceptions and fatal errors

public registerErrorHandler(array $levelMap = [], $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true) : self
public registerExceptionHandler( $levelMap = [], $callPrevious = true) : self
public registerFatalHandler( $level = NULL, int $reservedMemorySize = 20) : self
 
    Methods
    protected defaultErrorLevelMap() : array
    protected defaultExceptionLevelMap() : array
    Properties
    private $errorLevelMap
    private static $fatalErrors = [1, 4, 16, 64, 256]
    private $fatalLevel
    private $handleOnlyReportedErrors
    private $hasFatalErrorHandler
    private $lastFatalTrace
    private $logger
    private $previousErrorHandler
    private $previousExceptionHandler
    private $reservedMemory
    private $uncaughtExceptionLevelMap
    Methods
    private static codeToString( $code) : string
    Properties
    private static $fatalErrors = [1, 4, 16, 64, 256]
    Methods
    private static codeToString( $code) : string
    public static register(Psr\Log\LoggerInterface $logger, $errorLevelMap = [], $exceptionLevelMap = [], $fatalLevel = NULL) : self
     

    Registers a new ErrorHandler for a given Logger

    By default it will handle errors, exceptions and fatal errors

    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only