Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2012-09-12 23:30:04 +0400
committerVictor Dubiniuk <victor.dubiniuk@gmail.com>2012-09-12 23:30:04 +0400
commitbbf8bb0bb3f33c92933dfd499b571f56edda4a59 (patch)
treebfc30116008e9de88ea6c9b4d667d86c1938a20f /lib/log.php
parent9bfdf47cd43139ca5c3fba255fd4486d06b6d72c (diff)
Log PHP errors to the OC log
Diffstat (limited to 'lib/log.php')
-rw-r--r--lib/log.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/log.php b/lib/log.php
index 8bb2839be66..9c754cf60ce 100644
--- a/lib/log.php
+++ b/lib/log.php
@@ -36,4 +36,21 @@ class OC_Log {
$log_class=self::$class;
$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;
+ }
+ }
+
+ //Recoverable errors handler
+ public static function onError($number, $message, $file, $line){
+ self::write('PHP', $message . ' at ' . $file . '#' . $line, self::WARN);
+
+ }
}