LogRow
API reference › Debug Core › Panel › Log › LogRow
Typed log row narrowed once from the Yii logger tuple and persisted in that form.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$category readonly constructor | string | Log category attached to the message. | LogRow |
$context readonly constructor | array<array-key, | PSR-3 context normalized by LogContext::normalize(), or [] when the message carried none. Default: []. | LogRow |
$id readonly constructor | int | One-based row id assigned in capture order. | LogRow |
$idOfNext readonly constructor | int| | Row id of the next entry, or null for the last row of the request. | LogRow |
$idOfPrevious readonly constructor | int| | Row id of the previous entry, or null for the first row of the request. | LogRow |
$level readonly constructor | int | Logger level constant (LogLevel). | LogRow |
$memory readonly constructor | int | Memory usage in bytes reported by the logger, or 0 when the logger omitted it. | LogRow |
$message readonly constructor | string | Display string for the log payload. | LogRow |
$time readonly constructor | float | Capture timestamp in milliseconds since the Unix epoch. | LogRow |
$timeOfPrevious readonly constructor | float | Capture timestamp of the previous row in milliseconds, or this row’s own time for the first row. | LogRow |
$timeSincePrevious readonly constructor | float | Seconds elapsed between the previous row and this one. | LogRow |
$trace readonly constructor | list<array<string, | Backtrace frames captured at the log call site. | LogRow |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a log row from its captured logger data. | LogRow |
fromArray() static | Narrows one persisted message of the log payload into a typed row. | LogRow |
fromLoggerTuple() static | Converts one canonical logger tuple into a typed row. | LogRow |
jsonSerialize() | Returns the typed row for JSON serialization. | LogRow |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”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
| Parameter | Type | Description |
|---|---|---|
$id | int | |
$message | string | |
$level | int | |
$category | string | |
$time | float | |
$timeOfPrevious | float | |
$timeSincePrevious | float | |
$idOfPrevious | int| | |
$idOfNext | int| | |
$memory | int | |
$trace | array | |
$context | array |
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path): selfNarrows one persisted message of the log payload into a typed row.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Persisted message, expected to be an object carrying the declared shape. |
$path | string | JSON path of the message, used to report a malformed payload. |
Returns
self: Row carrying every persisted message field.
fromLoggerTuple()
Section titled “fromLoggerTuple() ”public static function fromLoggerTuple(PHPForge\Debug\Panel\Log\LogTuple $message, int $id, float $timeOfPrevious, int|null $idOfPrevious, int|null $idOfNext): selfConverts one canonical logger tuple into a typed row.
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | PHPForge\ | Logger tuple [message,; memory defaults to 0 and context to []. |
$id | int | One-based row id assigned in capture order. |
$timeOfPrevious | float | Timestamp of the previous row in seconds; this row’s own timestamp for the first. |
$idOfPrevious | int| | Row id preceding this one, or null for the first row. |
$idOfNext | int| | Row id following this one, or null for the last row. |
Returns
self
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Returns the typed row for JSON serialization.
Returns
array<string, mixed>