LogContext
API reference › Debug Core › Panel › Log › LogContext
Normalizes the PSR-3 context of a log message into a bounded, redacted, JSON-safe value tree.
Objects are reduced to readable strings and never inspected, so the tree always survives the strict JSON encoding of the capture.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
normalize() static | Normalizes a log context into a bounded JSON-safe tree. | LogContext |
Method details
Section titled “Method details”normalize()
Section titled “normalize() ”public static function normalize(array<array-key, mixed> $context, PHPForge\Debug\Capture\CapturePolicy $policy, list<string> $excludeKeys = []): array<array-key, mixed>Normalizes a log context into a bounded JSON-safe tree.
Keys become valid UTF-8 strings cut at MAX_KEY_BYTES bytes (PHP still stores numeric keys as
integers); a key that collides with an earlier one after the cut or the binary conversion gets a #2, #3
suffix instead of overwriting it. Values whose original key the policy denies become [redacted] at any depth,
and string values pass through CapturePolicy::redactText(). The whole tree retains at most
MAX_NODES values.
Parameters
| Parameter | Type | Description |
|---|---|---|
$context | array<array-key, | Context passed to the logger call. |
$policy | PHPForge\ | Host policy that decides which keys and text fragments are redacted. |
$excludeKeys | list<string> | Top-level keys dropped before normalization, such as logger-injected fields already shown as columns. |
Returns
array<array-key, mixed>: Bounded tree of null, bool, int, finite float, string, and arrays.