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