Skip to main content

Crate krabka_logfmt

Crate krabka_logfmt 

Source
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 the tracing level, where WARN becomes WARNING and TRACE becomes DEBUG. It sets the log entry’s LogSeverity.
  • 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§

CloudLogging
tracing_subscriber event 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 fmt layer that emits CloudLogging JSON, filtered by filter.