summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2017-07-05 11:58:32 +0200
committerGitHub <noreply@github.com>2017-07-05 11:58:32 +0200
commitd8af9d4c9b6bbcbc9b262b858c305ae6d911339a (patch)
tree7371285ab6643e3765779f031e2bd72a98b0acb2 /lib/private
parente836efe68b2a7c97fc6f6427546ef62c3a56cf3a (diff)
parentb27819785e32be24f289958efda79dec6358da00 (diff)
downloadnextcloud-server-d8af9d4c9b6bbcbc9b262b858c305ae6d911339a.tar.gz
nextcloud-server-d8af9d4c9b6bbcbc9b262b858c305ae6d911339a.zip
Merge pull request #5557 from nextcloud/dont-log-passwords-on-dav-exceptions-either
Don't log passwords on dav exceptions
Diffstat (limited to 'lib/private')
-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);
}
/**