Files
client-php/src/LogEvent.php

38 lines
998 B
PHP
Raw Normal View History

2025-09-06 01:21:02 +02:00
<?php
namespace LogDb\Client;
2025-09-06 01:38:42 +02:00
use DateTimeInterface;
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:38:42 +02:00
public readonly ?DateTimeInterface $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
}