PHP Class Jyxo\ErrorHandler

Author: Jaroslav HanslĂ­k
Datei anzeigen Open project: jyxo/php

Public Methods

Method Description
__construct ( ) Constructor preventing from creating class instances.
exception ( Exception $exception, boolean $fire = true ) : boolean Adds a caught exception.
handleError ( integer $type, string $message, string $file, integer $line, array $context ) : boolean Handles errors and logs them.
handleException ( Exception $exception ) Catches exceptions and logs them.
handleFatalError ( ) Handles critical errors and logs them.
init ( boolean $debug = false ) Initializes error handling.
log ( array $message, boolean $fire = true ) : boolean Logs a message.
setErrorMail ( Jyxo\ErrorMail $errorMail ) Sets \Jyxo\ErrorMail instance for sending fatal error emails (used by the shutdown function and error handler).

Private Methods

Method Description
firephp ( array $message ) : boolean Sends a message to FirePHP.
getAllPreviousExceptions ( Exception $exception ) : array Returns all exception's previous exceptions.
getTraceLog ( array $trace ) : string Returns trace log.

Method Details

__construct() final public method

Constructor preventing from creating class instances.
final public __construct ( )

exception() public static method

Adds a caught exception.
public static exception ( Exception $exception, boolean $fire = true ) : boolean
$exception Exception Caught exception
$fire boolean Shall we use FirePHP?
return boolean

handleError() public static method

Handles errors and logs them.
public static handleError ( integer $type, string $message, string $file, integer $line, array $context ) : boolean
$type integer Error type
$message string Error message
$file string File where the error occurred
$line integer Line on which the error occurred
$context array Error context variables
return boolean Was the error processed?

handleException() public static method

Catches exceptions and logs them.
public static handleException ( Exception $exception )
$exception Exception Uncaught exception

handleFatalError() public static method

Handles critical errors and logs them.
public static handleFatalError ( )

init() public static method

Initializes error handling.
public static init ( boolean $debug = false )
$debug boolean Turn debugging on?

log() public static method

Logs a message.
public static log ( array $message, boolean $fire = true ) : boolean
$message array Message definition
$fire boolean Shall we use FirePHP?
return boolean Was logging successful?

setErrorMail() public static method

Sets \Jyxo\ErrorMail instance for sending fatal error emails (used by the shutdown function and error handler).
public static setErrorMail ( Jyxo\ErrorMail $errorMail )
$errorMail Jyxo\ErrorMail