21 private static $FATAL_ERRORS = array(E_USER_ERROR =>
'', E_RECOVERABLE_ERROR =>
'');
23 private static $_logger = null;
29 set_error_handler(array($this,
'handleError'));
30 if (self::$_logger == null) {
41 debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
42 $trace = ob_get_contents();
46 $trace = preg_replace(
'/^#0\s+'.__FUNCTION__.
"[^\n]*\n/",
'', $trace, 1);
60 public function handleError($errno, $errstr, $errfile, $errline) {
61 $errorIsEnabled = (bool)($errno & ini_get(
'error_reporting'));
64 if(isset(self::$FATAL_ERRORS[$errno]) && $errorIsEnabled ) {
65 throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
69 else if( $errorIsEnabled ) {
70 self::$_logger->warn($errstr);
static getLogger($name)
Get the logger with the given name.
__construct()
Constructor.
handleError($errno, $errstr, $errfile, $errline)
Actual error handling method.
ErrorHandler catches all php errors and transforms fatal errors into ErrorExceptions and non-fatal in...
static getStackTrace()
Get the stack trace.