Add date, event batching
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace LogDb\Client;
|
||||
|
||||
class LogEvent
|
||||
use JsonSerializable;
|
||||
|
||||
class LogEvent implements JsonSerializable
|
||||
{
|
||||
public function __construct(
|
||||
public readonly string $brief,
|
||||
@@ -12,8 +14,23 @@ class LogEvent
|
||||
public readonly ?string $source = null,
|
||||
public readonly ?string $origin = null,
|
||||
public readonly array $context = [],
|
||||
public readonly ?DateTime $date = null,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user