From 0933dda8cc847252c10b9b28c2a34f83a513e8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20M=C3=BChlenpfordt?= Date: Thu, 13 Jun 2024 09:47:34 +0200 Subject: [PATCH] fix(logging): don't encode additionalData additionally --- Classes/Backend/JSONConsoleLogger.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Classes/Backend/JSONConsoleLogger.php b/Classes/Backend/JSONConsoleLogger.php index f7a568b..367e411 100644 --- a/Classes/Backend/JSONConsoleLogger.php +++ b/Classes/Backend/JSONConsoleLogger.php @@ -4,7 +4,6 @@ namespace t3n\FlowLog\Backend; -use Google\Cloud\BigQuery\Date; use Neos\Flow\Annotations as Flow; use Neos\Flow\Log\Backend\ConsoleBackend; @@ -62,12 +61,12 @@ public function append(string $message, int $severity = LOG_INFO, $additionalDat 'service' => $this->serviceContext['service'], 'version' => $this->serviceContext['version'], 'message' => $message, - 'additionalData' => json_encode($additionalData, JSON_THROW_ON_ERROR), - 'date' => new Date(new \DateTime('now')), + 'additionalData' => $additionalData, + 'date' => (new \DateTime('now'))->format('Y-m-d'), 'datetime' => new \DateTime('now') ]; $output = json_encode($data); - } catch (Exception $e) { + } catch (\Exception $e) { $data = [ 'severity' => $this->severityLabels[LOG_WARNING], 'service' => $this->serviceContext['service'], @@ -80,7 +79,7 @@ public function append(string $message, int $severity = LOG_INFO, $additionalDat ], 'stackTrace' => $e->getTraceAsString() ], - 'date' => new Date(new \DateTime('now')), + 'date' => (new \DateTime('now'))->format('Y-m-d'), 'datetime' => new \DateTime('now') ]; $output = json_encode($data);