Skip to content

Commit 00b4f19

Browse files
salmart-devbackportbot[bot]
authored andcommitted
perf(log): normalize log data only when logging
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
1 parent 19f716f commit 00b4f19

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/private/Log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,10 @@ public function logData(string $message, array $data, array $context = []): void
373373
$level = $context['level'] ?? ILogger::ERROR;
374374

375375
$minLevel = $this->getLogLevel($context, $message);
376-
$data = array_map($this->normalizer->format(...), $data);
377376

378377
try {
379378
if ($level >= $minLevel) {
379+
$data = array_map($this->normalizer->format(...), $data);
380380
$data['message'] = $message;
381381
if (!$this->logger instanceof IFileBased) {
382382
$data = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);

0 commit comments

Comments
 (0)