Loop 007
The logging coverage loop
A goal-based observability workflow that audits important paths, adds useful structured logs, and verifies success and failure events with tests.
Ready-to-use prompt
Copy the loop
Review the system's logging and add missing coverage until every important path produces useful, tested logs.
Verify / stop
Every important path emits useful, tested logs.
Representative success and failure tests prove coverage without exposing sensitive data.
Context and guidance When to use it, steps, safety notes, and related loops
Use this when
Use this when important user flows, service boundaries, background jobs, or failure paths are difficult to trace because the system's logging is incomplete or inconsistent.
How to run it
- Inventory the important paths and define the event, outcome, severity, correlation context, and fields each one should emit.
- Add structured logs to uncovered paths without duplicating events or adding low-value noise.
- Add tests for successful and failed outcomes, then inspect representative emitted logs for useful context.
- Verify redaction and repeat until every important path has tested coverage or a documented reason not to log.
Why it works
Treating logging as testable coverage turns observability from scattered statements into a reviewable system requirement. Inspecting emitted events catches gaps that source review alone misses.
Implementation note
Never log credentials, tokens, secrets, or sensitive personal data. Prefer stable event names and structured fields over interpolated prose.