summaryrefslogtreecommitdiffstats
path: root/lib/public/util.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-05 11:31:25 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-07 11:43:50 +0200
commit4a493c8835b606e9c2b74f275cb8c471adb5fa06 (patch)
tree30bf05b2bed64201937828826ad4f24739d1c922 /lib/public/util.php
parent341fcdc37a74b630ef7d47b5f0b336622c072ddc (diff)
downloadnextcloud-server-4a493c8835b606e9c2b74f275cb8c471adb5fa06.tar.gz
nextcloud-server-4a493c8835b606e9c2b74f275cb8c471adb5fa06.zip
Some expected Sabre exceptions are now logged with DEBUG level
Diffstat (limited to 'lib/public/util.php')
-rw-r--r--lib/public/util.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/public/util.php b/lib/public/util.php
index f06ddd66641..3b0fc09f7e5 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -86,21 +86,22 @@ class Util {
* if DEBUG mode is enabled
* @param string $app app name
* @param \Exception $ex exception to log
+ * @param string $level log level, defaults to \OCP\Util::FATAL
*/
- public static function logException( $app, \Exception $ex ) {
+ public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) {
$class = get_class($ex);
$message = $class . ': ' . $ex->getMessage();
if ($ex->getCode()) {
$message .= ' [' . $ex->getCode() . ']';
}
- \OCP\Util::writeLog($app, $message, \OCP\Util::FATAL);
+ \OCP\Util::writeLog($app, $message, $level);
if (defined('DEBUG') and DEBUG) {
// also log stack trace
$stack = explode("\n", $ex->getTraceAsString());
// first element is empty
array_shift($stack);
foreach ($stack as $s) {
- \OCP\Util::writeLog($app, 'Exception: ' . $s, \OCP\Util::FATAL);
+ \OCP\Util::writeLog($app, 'Exception: ' . $s, $level);
}
// include cause
@@ -110,7 +111,7 @@ class Util {
if ($ex->getCode()) {
$message .= '[' . $ex->getCode() . '] ';
}
- \OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
+ \OCP\Util::writeLog($app, 'Exception: ' . $message, $level);
}
}
}