Uncaught exception logging

This commit is contained in:
VicDeo 2012-09-26 14:38:06 +03:00
parent bbf8bb0bb3
commit 2b6869bcea
2 changed files with 8 additions and 2 deletions

View File

@ -319,6 +319,7 @@ class OC{
register_shutdown_function(array('OC_Log', 'onShutdown'));
set_error_handler(array('OC_Log', 'onError'));
set_exception_handler(array('OC_Log', 'onException'));
// set debug mode if an xdebug session is active
if (!defined('DEBUG') || !DEBUG) {

View File

@ -48,6 +48,11 @@ class OC_Log {
}
}
// Uncaught exception handler
public static function onException($exception){
self::write('PHP', $exception->getMessage() . ' at ' . $exception->getFile() . '#' . $exception->getLine(), self::FATAL);
}
//Recoverable errors handler
public static function onError($number, $message, $file, $line){
self::write('PHP', $message . ' at ' . $file . '#' . $line, self::WARN);