Skip to content

Instantly share code, notes, and snippets.

@seagoj
Created April 15, 2014 14:19
Show Gist options
  • Save seagoj/10736442 to your computer and use it in GitHub Desktop.
Save seagoj/10736442 to your computer and use it in GitHub Desktop.
Custom error handler
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