Skip to content

JsonStdoutSink

Default container sink: one compact JSON object per line to stdout.

Designed for FrankenPHP/Caddy → AKS → Azure Log Analytics: - Compact encoding (never JSON_PRETTY_PRINT) so embedded newlines in a value (e.g. a stack trace) are escaped and each event stays on ONE physical line = one Log Analytics record. - Written straight to php://stdout as bare JSON — NOT via error_log() — so Caddy’s own JSON logger does not wrap it into a “msg” string (“double JSON”). - A “src”:“app” discriminator distinguishes app events from Caddy access logs. Field schema (flat, KQL-friendly). Reserved keys always win over user properties on a name collision: ts, level, category, message, template?, src, exception? + flattened scope/properties.

final class JsonStdoutSink extends AbstractStreamSink

ExtendsAbstractStreamSink
SourceLogging/Sink/JsonStdoutSink.php

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
emit()AbstractStreamSinkRenders the event through the subclass JsonStdoutSink::format() and writes it as one newline-terminated line.
flush()AbstractStreamSinkFlushes the underlying stream if one has been opened.
isEnabled()AbstractStreamSinkWhether this sink accepts an event at $level for $category.