diff --git a/src/LogEvent.php b/src/LogEvent.php index 0076ea5..3f57b25 100644 --- a/src/LogEvent.php +++ b/src/LogEvent.php @@ -22,14 +22,20 @@ class LogEvent implements JsonSerializable public function jsonSerialize(): mixed { + $context = $this->context; + $scope = $this->scope; + if (isset($context['_scope'])) { + $scope = $context['_scope']; + unset($context['_scope']); + } return [ 'brief' => $this->brief, 'detail' => $this->detail, 'level' => $this->level, - 'scope' => $this->scope, + 'scope' => $scope, 'source' => $this->source, 'origin' => $this->origin, - 'context' => $this->context, + 'context' => $context, 'date' => $this->date?->format('Y-m-d H:i:s P'), ]; }