Expand description
Structured-JSON tracing log formatter shared across Krabka services.
Every Krabka service installs this formatter on its stdout fmt layer, so
container log collectors ingest each line as fields and not as
ANSI-coloured human text. Those services are the broker, the gateway, the
operator, and the schema-registry. The output is shaped for Google Cloud
Logging on GKE. That agent parses stdout JSON and recognises a few special
fields:
severity: mapped from thetracinglevel, whereWARNbecomesWARNINGandTRACEbecomesDEBUG. It sets the log entry’sLogSeverity.message: the event message, flattened to the top level, so it becomes the entry’s summary line.timestamp: RFC3339 UTC, recognised as the entry timestamp.
The formatter emits everything else at the top level too, that is the event
target and all the event fields. A line looks like this:
{"timestamp":"2026-06-13T05:55:09.951788Z","severity":"DEBUG","target":"krabka_broker::network::dispatch","message":"connection opened","listener":"PLAIN","sasl":false}The JSON formatter never writes ANSI escape codes, so logs stay clean in
non-TTY environments. The default tracing_subscriber fmt layer emits
ANSI colours even when stdout is not a terminal. This crate avoids that
bug.
Structs§
- Cloud
Logging tracing_subscriberevent formatter that emits one Cloud Logging-friendly JSON object per line. See the crate-level docs for the output shape.
Functions§
- layer
- Build a stdout
fmtlayer that emitsCloudLoggingJSON, filtered byfilter.