Skip to content
PHP Ecosystem
Explore

LogSnapshot

API reference › Debug Core › Panel › Log › LogSnapshot

final readonly classPHPForge\Debug\Panel\Log\LogSnapshot
ImplementsPHPForge\Debug\Storage\PanelSnapshot
Sourcesrc/Panel/Log/LogSnapshot.php

Canonical Log panel snapshot holding the captured rows in their typed form.

MethodDescriptionDefined by
__construct()Creates a log snapshot from captured rows.LogSnapshot
capture() staticConverts canonical logger tuples into typed rows, deriving the previous/next links and the inter-row deltas.LogSnapshot
entries()Returns the captured log rows.LogSnapshot
fromArray() staticNarrows the persisted log payload into a typed snapshot.LogSnapshot
jsonSerialize()Returns the panel snapshot for JSON serialization.LogSnapshot
public function __construct(list<PHPForge\Debug\Panel\Log\LogRow> $entries)

Creates a log snapshot from captured rows.

Parameters

ParameterTypeDescription
$entrieslist<LogRow>
public static function capture(list<PHPForge\Debug\Panel\Log\LogTuple> $messages): self

Converts canonical logger tuples into typed rows, deriving the previous/next links and the inter-row deltas.

Parameters

ParameterTypeDescription
$messageslist<PHPForge\Debug\Panel\Log\LogTuple>Logger tuples in capture order.

Returns

self

public function entries(): list<PHPForge\Debug\Panel\Log\LogRow>

Returns the captured log rows.

Returns

list<LogRow>: Captured rows in capture order.

public static function fromArray(mixed $data, string $path): self

Narrows the persisted log payload into a typed snapshot.

Parameters

ParameterTypeDescription
$datamixedPersisted payload, expected to be an object carrying an entries list.
$pathstringJSON path of the payload, used to report a malformed capture.

Returns

self: Snapshot carrying the persisted log rows.

public function jsonSerialize(): array<string, mixed>

Returns the panel snapshot for JSON serialization.

Returns

array<string, mixed>