StdoutLogger
class StdoutLogger implements StdoutLoggerInterface
Low-level PSR-3 logger that writes directly to stdout.
Used by Swoole server infrastructure that needs logging before the application log stack is available. Supports human-readable line and structured JSON output.
Traits
Constants
| private JSON_FLAGS |
|
| private STANDARD_LEVELS |
|
Methods
Reload the cached stdout logger configuration.
Log a message at the given level.
Format a human-readable log line with timestamp, colored level tag and context tags.
Format a structured JSON log line for log aggregators.
Encode a structured log entry without allowing user serializers to escape.
Interpolate context values into a message.
Normalize a top-level context value for structured output.
Convert a log value to a safe string representation.
Convert a stringable object without allowing its failure to mask a log entry.
Escape dynamic text that Symfony Console would otherwise interpret as markup.
Details
at line 54
__construct(Repository $config, OutputInterface|null $output = null)
No description
at line 66
void
reloadConfiguration()
Reload the cached stdout logger configuration.
Boot-only. The cached format and enabled levels affect every subsequent log entry in the worker.
at line 95
void
log(mixed $level, string|Stringable $message, array $context = [])
Log a message at the given level.
at line 136
protected string
getLineMessage(string $message, string $level = LogLevel::INFO, array $tags = [])
Format a human-readable log line with timestamp, colored level tag and context tags.
at line 158
protected string
getJsonMessage(string $message, string $level, array $tags, array $context)
Format a structured JSON log line for log aggregators.
at line 186
protected string|null
encodeJson(array $entry)
Encode a structured log entry without allowing user serializers to escape.
at line 200
protected string
interpolate(string $message, array $context)
Interpolate context values into a message.
at line 214
protected mixed
normalizeContextValue(mixed $value)
Normalize a top-level context value for structured output.
at line 228
protected string
stringify(mixed $value)
Convert a log value to a safe string representation.
at line 247
protected string
stringifyStringable(Stringable $value)
Convert a stringable object without allowing its failure to mask a log entry.
at line 259
protected string
escapeLineValue(string $value)
Escape dynamic text that Symfony Console would otherwise interpret as markup.