Skip to main content

Module logging

Module logging 

Source
Expand description

Structured debug logging system for SAF.

Provides the saf_log! macro for emitting structured debug output in a DSL format designed for AI coding agents:

[module::phase][tag] narrative | key=value key=value

Controlled at runtime via the SAF_LOG environment variable. No output when SAF_LOG is unset. Zero recompilation needed.

§Usage

use saf_core::saf_log;

// Full form: narrative + key-value pairs (use ; to separate)
saf_log!(pta::solve, worklist, "pts grew"; val=node_id, delta=&added);

// Narrative only
saf_log!(pta::solve, convergence, "fixpoint reached");

// Keys only (no narrative)
saf_log!(pta::solve, stats; iter=12, worklist=342);

Re-exports§

pub use value::PtsDelta;
pub use value::SafLogValue;
pub use value::SafPair;
pub use value::SafRatio;

Modules§

formatter
DSL line formatter for SAF structured debug logging.
registry
Module/phase registry for compile-time validation of saf_log! call sites.
subscriber
Subscriber initialization for SAF structured debug logging.
value
SafLogValue trait for formatting Rust values into the SAF log DSL.