Skip to main content

Module formatter

Module formatter 

Source
Expand description

Aurora console log formatter — pretty, colored, human-readable.

§CUSTOMIZE: Reference implementation

This is the canonical log formatter for the rmcp server family. It mirrors lab/crates/lab/src/log_fmt/formatter.rs exactly so that all servers in the family produce identically-formatted console logs.

When adapting Soma for your service:

  1. Copy this file unchanged — it needs no service-specific edits
  2. Adjust style_value() if you have additional semantic field names

§Log format produced

HH:MM:SS  INFO  starting  bind=0.0.0.0:3000  auth=bearer
HH:MM:SS  INFO  tool call  action=greet  elapsed_ms=12
HH:MM:SS  WARN  upstream slow  action=status  elapsed_ms=3200
HH:MM:SS ERROR  upstream failed  action=echo  error="connection refused"

Columns:

  • HH:MM:SS — local time, dim grey
  • LEVEL — 5 chars wide; ERROR=bold red, WARN=bold amber, INFO=plain, DEBUG/TRACE=dim
  • message — first token in pink+bold, inline key=val tokens get dim key
  • key=val — priority fields first, then alphabetical; keys dim, values semantic-colored

§Why a custom formatter instead of tracing_subscriber::fmt defaults?

The default tracing subscriber writes structured fields in a format like:

2026-05-13T14:32:01.123456Z  INFO soma: starting  bind="0.0.0.0:3000"

Problems with the default:

  • Full ISO timestamp is verbose (our HH:MM:SS is sufficient for dev logs)
  • Module path (soma:) adds noise
  • String values are always quoted (our formatter only quotes whitespace-containing values)
  • No semantic coloring for field values

The AuroraFormatter fixes all of these while staying compatible with tracing’s FormatEvent trait so it slots into the standard subscriber stack.

Structs§

AuroraFormatter
The Aurora console log formatter.