Created
February 22, 2013 09:08
-
-
Save Freeaqingme/5011931 to your computer and use it in GitHub Desktop.
PHP: Log parse errors to syslog()
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
<?php | |
register_shutdown_function(function() { | |
$error = error_get_last(); | |
if (!$error) { | |
return; | |
} | |
switch($error['type']){ | |
case E_ERROR: | |
case E_CORE_ERROR: | |
case E_COMPILE_ERROR: | |
case E_USER_ERROR: | |
case E_PARSE: | |
syslog( | |
LOG_EMERG, | |
sprintf('%s in file %s on line %d', | |
$error['message'], | |
$error['file'], | |
$error['line'] | |
) | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment