Created
August 27, 2015 09:00
-
-
Save bjzhush/afd2b2b8a4cc08cf530d to your computer and use it in GitHub Desktop.
Exception 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
<?php | |
function zsExceptionHandler(\Exception $e) | |
{ | |
$logData = '__________Start_____________'.PHP_EOL; | |
$logData .= '↓↓↓'.date('Y-m-d H:i:s').PHP_EOL; | |
$logData .= '↓↓↓ Message'.PHP_EOL; | |
$logData .= $e->getMessage().PHP_EOL; | |
$logData .= '↓↓↓ Code'.PHP_EOL; | |
$logData .= $e->getCode().PHP_EOL; | |
$logData .= '↓↓↓ TraceString'.PHP_EOL; | |
$logData .= $e->getTraceAsString().PHP_EOL; | |
$logData .= '↓↓↓ File'.PHP_EOL; | |
$logData .= $e->getFile().PHP_EOL; | |
$logData .= '__________End_____________'.PHP_EOL; | |
$logData .= PHP_EOL; | |
$logFile = '../log/zs_excep.log'; | |
return error_log($logData, 3, $logFile); | |
} | |
$errLogFile = '../log/zs_error.log'; | |
set_exception_handler('zsExceptionHandler'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment