summaryrefslogtreecommitdiffstats
path: root/lib/private/Log.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-06-29 11:43:32 +0200
committerJoas Schilling <coding@schilljs.com>2017-06-29 17:20:10 +0200
commitb27819785e32be24f289958efda79dec6358da00 (patch)
treec811068bdf65550d74b53be0ef80a19693f9f146 /lib/private/Log.php
parent045d04332e00acbe28adbad54e4b9c5ce8486d38 (diff)
downloadnextcloud-server-b27819785e32be24f289958efda79dec6358da00.tar.gz
nextcloud-server-b27819785e32be24f289958efda79dec6358da00.zip
Don't log passwords on dav exceptions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Log.php')
-rw-r--r--lib/private/Log.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php
index ea20353a0a0..0d291218096 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -305,13 +305,18 @@ class Log implements ILogger {
/**
* Logs an exception very detailed
*
- * @param \Exception | \Throwable $exception
+ * @param \Exception|\Throwable $exception
* @param array $context
* @return void
* @since 8.2.0
*/
public function logException($exception, array $context = array()) {
- $exception = array(
+ $level = Util::ERROR;
+ if (isset($context['level'])) {
+ $level = $context['level'];
+ unset($context['level']);
+ }
+ $data = array(
'Exception' => get_class($exception),
'Message' => $exception->getMessage(),
'Code' => $exception->getCode(),
@@ -319,10 +324,10 @@ class Log implements ILogger {
'File' => $exception->getFile(),
'Line' => $exception->getLine(),
);
- $exception['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $exception['Trace']);
+ $data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
$msg = isset($context['message']) ? $context['message'] : 'Exception';
- $msg .= ': ' . json_encode($exception);
- $this->error($msg, $context);
+ $msg .= ': ' . json_encode($data);
+ $this->log($level, $msg, $context);
}
/**