mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-08-26 16:01:17 +00:00
* Rework WARN and ERR logs during startup * Clean up noise from start up logs * Rework node hot path logs to only have crucial logs at INFO level * Logs rework archive, filter, LP, peer ex, rdv, store * Rework logs for waku_relay and rln * rework logs for waku_node layer * rework lgos for waku common and core * Rework discovery and factory logs * Rework logs for rest api endpoints * Rework logs for messaging delivery service and channel lifecycle * Rework logs in api directories * Minor log cleanups * Add info log for message recv by msg or reliable channels API * Add metric to send_service, revert node/rln metrics to INFO lvl * return WARN lvl to build conf preset * revert log lvl to error for healthLoop exception * Log error level for failures to serve API level requests * Revert some debug logs to error or warn level
3.4 KiB
3.4 KiB
Logging policy
This document defines what each log level means in Logos Messaging and how to choose a level for a new log statement. It exists so that levels carry a consistent, enforceable meaning for our two main audiences:
- Operators run at
INFO: node state and health, no noise. - Developers run at
DEBUG: protocol interactions, no spam.
Guiding principle
A healthy node logs nothing at WARN or above.
Every WARN/ERROR/FATAL line must indicate something to fix, investigate, or
report. In review, ask: would a healthy node ever hit this line? If yes, it is
not WARN or above.
Levels
Increasing severity: TRACE, DEBUG, INFO, NOTICE, WARN, ERROR,
FATAL.
- TRACE — high-volume internals: per-message relay/gossipsub handling, payloads, validation internals, loop ticks. Filtered to a topic when used.
- DEBUG — the developer narrative: one line per protocol interaction (request served, peer selected, dial result, retry attempt). Scales with protocol activity, not raw throughput.
- INFO — the operator narrative: lifecycle steps, one mount summary, connection-state changes, one periodic health line, and messages sent or received through the Messaging / Reliable Channels API. Not for per-peer-event churn.
- NOTICE — rare must-see lifecycle facts, visible above
INFO: node started (version, addresses, ENR), shutdown initiated. A handful per process. - WARN — degraded but recoverable, or config needing attention: exhausted retries for an optional capability, suspicious-but-valid config, deprecated options.
- ERROR — local malfunction: a broken internal assumption, a node-initiated operation that failed and impairs this node, or a request the node could not serve on its own API. Never caused solely by remote-peer input.
- FATAL — node cannot continue; process exit follows.
Decision rules
- Remote/network anomalies (invalid messages, malformed ENRs, unreachable
peers) —
DEBUG(TRACEon the per-message path) plus a metric counter. - Retry loops — each attempt
DEBUGwith attempt number; on exhaustionWARNif an optional capability is degraded,ERRORif core function is lost. - Persistent conditions — log the transition, not every tick. Repeats go
to
DEBUG. - API request failures — when the node cannot serve a request made through
its own API (REST, FFI, library, protocol client) and returns an error to the
caller,
ERROR: the requested operation definitively failed. Idempotent no-ops on that path ("already started", "already subscribed") stayDEBUG. - Deprecated options — config to be removed in future versions;
WARNonce, at config-parse time. - Periodic status — one consolidated
INFOline per tick; detail to metrics orDEBUG. - Hot paths — request/response protocols
DEBUGper request; relay/gossipTRACEper message.
Style
- Start the message with a capital letter.
- Keep the message a constant with variable data in
key = valuefields, including the cause on failures (error = $err). - Log an error at the boundary where it is handled, not before returning it.
- One
logScopetopic per module. - No side effects or expensive computation in log arguments; lower levels may be compiled out.
- Give any demoted
WARN/ERRORa metric counter if it was the only signal.