Structured server logging implementation plan
Goal: Make existing operational tracing events observable as structured
stderr logs from every lake process.
Architecture: Subscriber ownership belongs at the binary application
boundary. Domain crates continue emitting tracing events without depending
on output format or deployment configuration.
Task 1: Prove the process-level logging contract
- Add integration tests that launch the compiled binary as a subprocess.
- Assert JSON mode emits a parseable startup record before clap rejects an invalid command and never writes logs to stdout.
- Assert an invalid format fails before a requested data directory is created.
- Lock the default JSON/filter behavior and pretty stderr/ANSI behavior with subprocess and captured-subscriber tests.
- Run the tests and confirm RED because no subscriber/configuration exists.
Task 2: Install the subscriber at startup
- Add
tracing-subscriberwithenv-filter,fmt, andjsonfeatures. - Parse the two environment boundaries with explicit defaults and errors.
- Install JSON or pretty stderr output before command parsing.
- Emit one version-only startup event and confirm both tests GREEN.
Task 3: Document and verify
- Document defaults, environment overrides, stderr/stdout separation, and the no-sensitive-fields boundary.
- Run spec lifecycle, strict clippy, and the full local gate.
- Obtain independent verifier and reviewer approval, then ship and merge.