Skip to main content

Module logging

Module logging 

Source
Expand description

Node logging (blueprint §9.1’s log_{error..trace} / log_with_fields).

A node’s logs go two places at once, and both matter:

  • Over the wire, as kind = Log frames carrying an astrs_wire::LogRecord, so astrs logs and the TUI see them interleaved with every other node’s by HLC order (§13).
  • Into tracing, so a node that already instruments itself with tracing keeps its local subscriber, its spans, and its RUST_LOG.

Sending only over the wire would make a node undebuggable without a daemon; emitting only locally would make a dataflow undebuggable without ssh. Doing both costs one extra macro call per record.

§Stamping

Every record carries this node’s HLC reading, its node id and its dataflow id before it leaves. That is what lets the merger in astrs-log order records from machines whose wall clocks disagree.

§A dropped log is not an error

Logging must never take a node down, and a node that cannot log is usually a node whose daemon has already gone. The log_* methods therefore return (); Node::try_log is there for the rare caller that wants to know.