summaryrefslogtreecommitdiffstats
path: root/lib/log.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-12-07 11:35:24 +0100
committerBart Visscher <bartv@thisnet.nl>2012-12-07 11:35:57 +0100
commit89cd8a3fc75f9b96d295ae4292ee92102c3138a6 (patch)
treeaab017f29362c92e5a3e28c5b84960ee6e0072ea /lib/log.php
parent8bb62e74bd14e4fec6ed1cd371d21af0f618076b (diff)
parentc487d9fc7e5b1c31069819cc8adc920ab9660513 (diff)
downloadnextcloud-server-89cd8a3fc75f9b96d295ae4292ee92102c3138a6.tar.gz
nextcloud-server-89cd8a3fc75f9b96d295ae4292ee92102c3138a6.zip
Merge branch 'master' into doctrine
Conflicts: lib/base.php lib/db.php
Diffstat (limited to 'lib/log.php')
-rw-r--r--lib/log.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/log.php b/lib/log.php
index 6de99b4ea6b..e9cededa5c0 100644
--- a/lib/log.php
+++ b/lib/log.php
@@ -39,4 +39,29 @@ class OC_Log {
$log_class::write($app, $message, $level);
}
}
+
+ //Fatal errors handler
+ public static function onShutdown() {
+ $error = error_get_last();
+ if($error) {
+ //ob_end_clean();
+ self::write('PHP', $error['message'] . ' at ' . $error['file'] . '#' . $error['line'], self::FATAL);
+ } else {
+ return true;
+ }
+ }
+
+ // 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) {
+ if (error_reporting() === 0) {
+ return;
+ }
+ self::write('PHP', $message . ' at ' . $file . '#' . $line, self::WARN);
+
+ }
}