Skip to content

Commit

Permalink
Merge pull request #17 from nutgram/fix-formatter
Browse files Browse the repository at this point in the history
Fix for missing type
  • Loading branch information
sergix44 authored Dec 4, 2023
2 parents 09a6e7f + 6743ac2 commit c960924
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Log/NutgramFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c960924

Please sign in to comment.