Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
1a019ccfd3 | |||
c7ba4a6942 |
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace LogDb\Client;
|
namespace LogDb\Client;
|
||||||
|
|
||||||
|
use DateTimeInterface;
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
|
||||||
class LogEvent implements JsonSerializable
|
class LogEvent implements JsonSerializable
|
||||||
@@ -14,21 +15,27 @@ class LogEvent implements JsonSerializable
|
|||||||
public readonly ?string $source = null,
|
public readonly ?string $source = null,
|
||||||
public readonly ?string $origin = null,
|
public readonly ?string $origin = null,
|
||||||
public readonly array $context = [],
|
public readonly array $context = [],
|
||||||
public readonly ?DateTime $date = null,
|
public readonly ?DateTimeInterface $date = null,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
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