LogRegistry
Process-global store of logging configuration: the default minimum level, the per-category minimum levels, and the registered sinks.
Deliberately free of any dependency on Config / the context / bootstrap, so it can be configured in index.php BEFORE Kernel::run() and is usable during bootstrap itself. Configuration is set once at worker startup and is immutable for the worker lifetime (the only per-request logging state lives in LogContext). Log is the public facade over this store.
Synopsis
Section titled “Synopsis”final class LogRegistry
| Source | Logging/LogRegistry.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
addSink(SinkInterface $sink): void | Appends a sink to the process-global sink list, in registration order. |
generation(): int | The current configuration generation, for consumers that memoize a resolved level or sink decision of their own. |
hasSinks(): bool | Reports whether any sink is registered. |
reset(): void | Reset all configuration and drop sinks. |
resolveLevel(string $category): Level | Resolve the minimum level for a category: the level of the longest configured prefix that matches on a dot boundary, else the default. |
setDefaultLevel(Level $level): void | Sets the minimum level applied to categories with no matching prefix rule. |
setLevel(string $categoryPrefix, Level $level): void | Sets the minimum level for one dotted category prefix, replacing any level already stored for that exact prefix. |
setLevels(array<string, Level> $map): void | |
sinks(): list<SinkInterface> |
addSink()
Section titled “addSink()”public static function addSink(SinkInterface $sink): void
Appends a sink to the process-global sink list, in registration order.
No de-duplication is performed: registering the same sink twice makes it receive every record twice.
| Parameter | Type | Description |
|---|---|---|
$sink | SinkInterface |
generation()
Section titled “generation()”public static function generation(): int
The current configuration generation, for consumers that memoize a resolved level or sink decision of their own.
Returns int
hasSinks()
Section titled “hasSinks()”public static function hasSinks(): bool
Reports whether any sink is registered.
False means every record is discarded regardless of level, so callers can skip building a record at all.
Returns bool
reset()
Section titled “reset()”public static function reset(): void
Reset all configuration and drop sinks.
For test isolation and reconfiguration; not used on the request path.
resolveLevel()
Section titled “resolveLevel()”public static function resolveLevel(string $category): Level
Resolve the minimum level for a category: the level of the longest configured prefix that matches on a dot boundary, else the default.
Memoized per exact category string.
| Parameter | Type | Description |
|---|---|---|
$category | string |
Returns Level
setDefaultLevel()
Section titled “setDefaultLevel()”public static function setDefaultLevel(Level $level): void
Sets the minimum level applied to categories with no matching prefix rule.
Discards the resolved-threshold memo, so categories that had fallen through to the previous default are re-resolved on their next log call.
| Parameter | Type | Description |
|---|---|---|
$level | Level |
setLevel()
Section titled “setLevel()”public static function setLevel(string $categoryPrefix, Level $level): void
Sets the minimum level for one dotted category prefix, replacing any level already stored for that exact prefix.
Discards the resolved-threshold memo so existing categories re-resolve against the new rule; see LogRegistry::resolveLevel() for how competing prefixes are ranked.
| Parameter | Type | Description |
|---|---|---|
$categoryPrefix | string | |
$level | Level |
setLevels()
Section titled “setLevels()”public static function setLevels(array<string, Level> $map): void
category-prefix => Level
| Parameter | Type | Description |
|---|---|---|
$map | array``<``string``, Level> | category-prefix => Level |
sinks()
Section titled “sinks()”public static function sinks(): list<SinkInterface>
Returns list``<SinkInterface>