Skip to content

Instantly share code, notes, and snippets.

@mesaque
Created October 2, 2015 14:24
Show Gist options
  • Save mesaque/781fea864b9589a569a1 to your computer and use it in GitHub Desktop.
Save mesaque/781fea864b9589a569a1 to your computer and use it in GitHub Desktop.
set_error_handler("myErrorHandler");
function myErrorHandler($errno, $errstr, $errfile, $errline){
switch ($errno) {
case E_USER_ERROR:
file_put_contents('/tmp/debug.log', "[Fatal error]{$errstr} \n", FILE_APPEND);
break;
case E_USER_WARNING:
file_put_contents('/tmp/debug.log', "[WARNING]{$errstr} \n", FILE_APPEND);
break;
case E_USER_NOTICE:
file_put_contents('/tmp/debug.log', "[NOTICE]{$errstr} \n", FILE_APPEND);
break;
default:
file_put_contents('/tmp/debug.log', "[Unknown]{$errstr} \n", FILE_APPEND);
break;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment