Created
April 15, 2014 14:19
-
-
Save seagoj/10736442 to your computer and use it in GitHub Desktop.
Custom error handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function error_handler($errno, $errstr, $errfile, $errline, $errcontext) { | |
global $errorLog; | |
if (is_array($errstr) || is_object($errstr)) { | |
$errstr = var_export($errstr, true); | |
} | |
$message = "$errno:$errfile:$errline:$errstr:".json_encode($errcontext); | |
if (isset($errorLog) && get_class($errorLog)==='Devtools\Log') { | |
$errorLog->write($message, false); | |
} else { | |
echo $message; | |
} | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment