Skip to content
PHP Ecosystem
Explore

LogContext

API reference › Debug Core › Panel › Log › LogContext

final classPHPForge\Debug\Panel\Log\LogContext
Sourcesrc/Panel/Log/LogContext.php

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.

MethodDescriptionDefined by
normalize() staticNormalizes a log context into a bounded JSON-safe tree.LogContext
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

ParameterTypeDescription
$contextarray<array-key, mixed>Context passed to the logger call.
$policyPHPForge\Debug\Capture\CapturePolicyHost policy that decides which keys and text fragments are redacted.
$excludeKeyslist<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.