Skip to main content

saf_log

Macro saf_log 

Source
macro_rules! saf_log {
    ($module:ident :: $phase:ident, $tag:ident, $narrative:expr; $($key:ident = $val:expr),+ $(,)?) => { ... };
    ($module:ident :: $phase:ident, $tag:ident, $narrative:expr) => { ... };
    ($module:ident :: $phase:ident, $tag:ident; $($key:ident = $val:expr),+ $(,)?) => { ... };
}
Expand description

Emit a structured SAF debug log event.

The macro validates module::phase at compile time via the registry, serializes key-value pairs via SafLogValue, and emits a tracing event at TRACE level with target "saf_debug".

§Forms

// Full: narrative + key-values (semicolon separates narrative from keys)
saf_log!(module::phase, tag, "narrative"; key=expr, key2=expr2);

// Narrative only (no key-values)
saf_log!(module::phase, tag, "narrative");

// Keys only (no narrative)
saf_log!(module::phase, tag; key=expr, key2=expr2);

The output DSL uses | as separator, but the macro uses ; because Rust macro rules do not allow | after expr fragments.