diff options
-rw-r--r-- | lib/private/Log.php | 6 | ||||
-rw-r--r-- | lib/private/Support/CrashReport/Registry.php | 4 | ||||
-rw-r--r-- | lib/public/Support/CrashReport/IRegistry.php | 9 |
3 files changed, 18 insertions, 1 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php index 4ab647bc6c1..e4be5134f11 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -312,6 +312,11 @@ class Log implements ILogger, IDataLogger { $app = $context['app'] ?? 'no app in context'; $level = $context['level'] ?? ILogger::ERROR; + $minLevel = $this->getLogLevel($context); + if ($level < $minLevel && ($this->crashReporters === null || !$this->crashReporters->hasReporters())) { + return; + } + // if an error is raised before the autoloader is properly setup, we can't serialize exceptions try { $serializer = $this->getSerializer(); @@ -325,7 +330,6 @@ class Log implements ILogger, IDataLogger { $data = array_merge($serializer->serializeException($exception), $data); $data = $this->interpolateMessage($data, $context['message'] ?? '--', 'CustomMessage'); - $minLevel = $this->getLogLevel($context); array_walk($context, [$this->normalizer, 'format']); diff --git a/lib/private/Support/CrashReport/Registry.php b/lib/private/Support/CrashReport/Registry.php index 472f39c2884..f5457f60ad4 100644 --- a/lib/private/Support/CrashReport/Registry.php +++ b/lib/private/Support/CrashReport/Registry.php @@ -147,4 +147,8 @@ class Registry implements IRegistry { } } } + + public function hasReporters(): bool { + return !empty($this->lazyReporters) || !empty($this->reporters); + } } diff --git a/lib/public/Support/CrashReport/IRegistry.php b/lib/public/Support/CrashReport/IRegistry.php index 6ee2b57f613..35cf78920da 100644 --- a/lib/public/Support/CrashReport/IRegistry.php +++ b/lib/public/Support/CrashReport/IRegistry.php @@ -81,4 +81,13 @@ interface IRegistry { * @since 17.0.0 */ public function delegateMessage(string $message, array $context = []): void; + + /** + * Check if any reporter has been registered to delegate to + * + * @return bool + * @deprecated use internally only + * @since 26.0.0 + */ + public function hasReporters(): bool; } |