From d3a244f9d9f3a90b7bd92a22210601c7f543441f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 9 May 2019 14:06:44 +0200 Subject: Allow crash reporters to catpture any message Signed-off-by: Christoph Wurst --- lib/private/Log.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lib/private/Log.php') diff --git a/lib/private/Log.php b/lib/private/Log.php index 43ff4cc9dee..4af833d778f 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -35,6 +35,7 @@ declare(strict_types=1); namespace OC; +use function array_merge; use InterfaSys\LogNormalizer\Normalizer; use OC\Log\ExceptionSerializer; @@ -42,7 +43,6 @@ use OCP\Log\IFileBased; use OCP\Log\IWriter; use OCP\ILogger; use OCP\Support\CrashReport\IRegistry; -use OCP\Util; /** * logging utilities @@ -216,11 +216,22 @@ class Log implements ILogger { if ($level >= $minLevel) { $this->writeLog($app, $message, $level); - } - if (!is_null($this->crashReporters)) { - $this->crashReporters->delegateBreadcrumb($message, 'log', $context); + if ($this->crashReporters !== null) { + $messageContext = array_merge( + $context, + [ + 'level' => $level + ] + ); + $this->crashReporters->delegateMessage($message, $messageContext); + } + } else { + if ($this->crashReporters !== null) { + $this->crashReporters->delegateBreadcrumb($message, 'log', $context); + } } + } private function getLogLevel($context) { -- cgit v1.2.3