Apply scope from context in LogEvent serialize
This commit is contained in:
@@ -22,14 +22,20 @@ class LogEvent implements JsonSerializable
|
|||||||
|
|
||||||
public function jsonSerialize(): mixed
|
public function jsonSerialize(): mixed
|
||||||
{
|
{
|
||||||
|
$context = $this->context;
|
||||||
|
$scope = $this->scope;
|
||||||
|
if (isset($context['_scope'])) {
|
||||||
|
$scope = $context['_scope'];
|
||||||
|
unset($context['_scope']);
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'brief' => $this->brief,
|
'brief' => $this->brief,
|
||||||
'detail' => $this->detail,
|
'detail' => $this->detail,
|
||||||
'level' => $this->level,
|
'level' => $this->level,
|
||||||
'scope' => $this->scope,
|
'scope' => $scope,
|
||||||
'source' => $this->source,
|
'source' => $this->source,
|
||||||
'origin' => $this->origin,
|
'origin' => $this->origin,
|
||||||
'context' => $this->context,
|
'context' => $context,
|
||||||
'date' => $this->date?->format('Y-m-d H:i:s P'),
|
'date' => $this->date?->format('Y-m-d H:i:s P'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user