2025-09-06 01:21:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace LogDb\Client;
|
|
|
|
|
|
2025-09-06 01:35:04 +02:00
|
|
|
use JsonSerializable;
|
|
|
|
|
|
|
|
|
|
class LogEvent implements JsonSerializable
|
2025-09-06 01:21:02 +02:00
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
public readonly string $brief,
|
|
|
|
|
public readonly ?string $detail = null,
|
|
|
|
|
public readonly ?string $level = null,
|
|
|
|
|
public readonly ?string $scope = null,
|
|
|
|
|
public readonly ?string $source = null,
|
|
|
|
|
public readonly ?string $origin = null,
|
|
|
|
|
public readonly array $context = [],
|
2025-09-06 01:35:04 +02:00
|
|
|
public readonly ?DateTime $date = null,
|
2025-09-06 01:21:02 +02:00
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
}
|
2025-09-06 01:35:04 +02:00
|
|
|
|
|
|
|
|
public function jsonSerialize(): mixed
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'brief' => $this->brief,
|
|
|
|
|
'detail' => $this->detail,
|
|
|
|
|
'level' => $this->level,
|
|
|
|
|
'scope' => $this->scope,
|
|
|
|
|
'source' => $this->source,
|
|
|
|
|
'origin' => $this->origin,
|
|
|
|
|
'context' => $this->context,
|
|
|
|
|
'date' => $this->date?->format('Y-m-d H:i:s P'),
|
|
|
|
|
];
|
|
|
|
|
}
|
2025-09-06 01:21:02 +02:00
|
|
|
}
|
|
|
|
|
|