[Pkg-owncloud-commits] [owncloud] 22/145: also load error handler if debugging is enabled
David Prévot
taffit at moszumanska.debian.org
Wed Feb 26 16:27:39 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 34069e00c497bf5651a041595411f876f79feecf
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Fri Jan 31 13:27:51 2014 +0100
also load error handler if debugging is enabled
---
lib/base.php | 3 ++-
lib/private/log/errorhandler.php | 18 +++++++++++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/base.php b/lib/base.php
index 5470cf2..9c2eecf 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -488,11 +488,12 @@ class OC {
if (!defined('PHPUNIT_RUN')) {
if (defined('DEBUG') and DEBUG) {
+ OC\Log\ErrorHandler::register(true);
set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
} else {
OC\Log\ErrorHandler::register();
- OC\Log\ErrorHandler::setLogger(OC_Log::$object);
}
+ OC\Log\ErrorHandler::setLogger(OC_Log::$object);
}
// register the stream wrappers
diff --git a/lib/private/log/errorhandler.php b/lib/private/log/errorhandler.php
index 4460468..f6c96ef 100644
--- a/lib/private/log/errorhandler.php
+++ b/lib/private/log/errorhandler.php
@@ -23,10 +23,14 @@ class ErrorHandler {
return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
}
- public static function register() {
+ public static function register($debug=false) {
$handler = new ErrorHandler();
- set_error_handler(array($handler, 'onError'));
+ if ($debug) {
+ set_error_handler(array($handler, 'onAll'), E_ALL);
+ } else {
+ set_error_handler(array($handler, 'onError'));
+ }
register_shutdown_function(array($handler, 'onShutdown'));
set_exception_handler(array($handler, 'onException'));
}
@@ -57,7 +61,15 @@ class ErrorHandler {
return;
}
$msg = $message . ' at ' . $file . '#' . $line;
- self::$logger->warning(self::removePassword($msg), array('app' => 'PHP'));
+ self::$logger->error(self::removePassword($msg), array('app' => 'PHP'));
+
+ }
+
+ //Recoverable handler which catch all errors, warnings and notices
+ public static function onAll($number, $message, $file, $line) {
+ $msg = $message . ' at ' . $file . '#' . $line;
+ self::$logger->debug(self::removePassword($msg), array('app' => 'PHP'));
}
+
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list