From 6743ac21817e97901bc0a83809c46bccc5f6f94e Mon Sep 17 00:00:00 2001 From: Luca Patera Date: Mon, 4 Dec 2023 18:57:16 +0100 Subject: [PATCH] Fix for missing type --- src/Log/NutgramFormatter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Log/NutgramFormatter.php b/src/Log/NutgramFormatter.php index 9ddfb19..9bca0db 100644 --- a/src/Log/NutgramFormatter.php +++ b/src/Log/NutgramFormatter.php @@ -10,7 +10,13 @@ class NutgramFormatter implements FormatterInterface { public function format(LogRecord $record): void { - $record->context['type'] === 'request' ? $this->formatRequest($record) : $this->formatResponse($record); + $type = $record->context['type'] ?? null; + + if ($type === 'request') { + $this->formatRequest($record); + } elseif ($type === 'response') { + $this->formatResponse($record); + } } public function formatBatch(array $records): void