Skip to content
PHP Ecosystem
Explore

LogRow

API reference › Debug Core › Panel › Log › LogRow

final readonly classPHPForge\Debug\Panel\Log\LogRow
ImplementsPHPForge\Debug\Storage\PanelRow
Sourcesrc/Panel/Log/LogRow.php

Typed log row narrowed once from the Yii logger tuple and persisted in that form.

PropertyTypeDescriptionDefined by
$category readonly constructorstringLog category attached to the message.LogRow
$context readonly constructorarray<array-key, mixed>PSR-3 context normalized by LogContext::normalize(), or [] when the message carried none. Default: [].LogRow
$id readonly constructorintOne-based row id assigned in capture order.LogRow
$idOfNext readonly constructorint|nullRow id of the next entry, or null for the last row of the request.LogRow
$idOfPrevious readonly constructorint|nullRow id of the previous entry, or null for the first row of the request.LogRow
$level readonly constructorintLogger level constant (LogLevel).LogRow
$memory readonly constructorintMemory usage in bytes reported by the logger, or 0 when the logger omitted it.LogRow
$message readonly constructorstringDisplay string for the log payload.LogRow
$time readonly constructorfloatCapture timestamp in milliseconds since the Unix epoch.LogRow
$timeOfPrevious readonly constructorfloatCapture timestamp of the previous row in milliseconds, or this row’s own time for the first row.LogRow
$timeSincePrevious readonly constructorfloatSeconds elapsed between the previous row and this one.LogRow
$trace readonly constructorlist<array<string, mixed>>Backtrace frames captured at the log call site.LogRow
MethodDescriptionDefined by
__construct()Creates a log row from its captured logger data.LogRow
fromArray() staticNarrows one persisted message of the log payload into a typed row.LogRow
fromLoggerTuple() staticConverts one canonical logger tuple into a typed row.LogRow
jsonSerialize()Returns the typed row for JSON serialization.LogRow
public function __construct(int $id, string $message, int $level, string $category, float $time, float $timeOfPrevious, float $timeSincePrevious, int|null $idOfPrevious, int|null $idOfNext, int $memory, array $trace, array $context = [])

Creates a log row from its captured logger data.

Parameters

ParameterTypeDescription
$idint
$messagestring
$levelint
$categorystring
$timefloat
$timeOfPreviousfloat
$timeSincePreviousfloat
$idOfPreviousint|null
$idOfNextint|null
$memoryint
$tracearray
$contextarray
public static function fromArray(mixed $data, string $path): self

Narrows one persisted message of the log payload into a typed row.

Parameters

ParameterTypeDescription
$datamixedPersisted message, expected to be an object carrying the declared shape.
$pathstringJSON path of the message, used to report a malformed payload.

Returns

self: Row carrying every persisted message field.

public static function fromLoggerTuple(PHPForge\Debug\Panel\Log\LogTuple $message, int $id, float $timeOfPrevious, int|null $idOfPrevious, int|null $idOfNext): self

Converts one canonical logger tuple into a typed row.

Parameters

ParameterTypeDescription
$messagePHPForge\Debug\Panel\Log\LogTupleLogger tuple [message, level, category, timestamp, traces, memory, context]; memory defaults to 0 and context to [].
$idintOne-based row id assigned in capture order.
$timeOfPreviousfloatTimestamp of the previous row in seconds; this row’s own timestamp for the first.
$idOfPreviousint|nullRow id preceding this one, or null for the first row.
$idOfNextint|nullRow id following this one, or null for the last row.

Returns

self

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

Returns the typed row for JSON serialization.

Returns

array<string, mixed>