From 00b4f19ffdd4bdc8b336f705da8daca6a8f51593 Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:14:07 +0200 Subject: [PATCH] perf(log): normalize log data only when logging Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- lib/private/Log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Log.php b/lib/private/Log.php index a7b1a5fba0bcc..96703adfb8d07 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -373,10 +373,10 @@ public function logData(string $message, array $data, array $context = []): void $level = $context['level'] ?? ILogger::ERROR; $minLevel = $this->getLogLevel($context, $message); - $data = array_map($this->normalizer->format(...), $data); try { if ($level >= $minLevel) { + $data = array_map($this->normalizer->format(...), $data); $data['message'] = $message; if (!$this->logger instanceof IFileBased) { $data = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);