Skip to main content

Module layer

Module layer 

Source
Expand description

tracing-subscriber Layer that captures record! emissions and attribution_span! spans, assembling alias-bound LogEvents and routing them to JSONL persistence, the broadcast hook, and the Observer bridge.

Two recognized span/event shapes:

  1. attribution_span!(thing) — opens a span with target = "zeroclaw_log_internal_attribution" carrying zc_role_family, zc_role_type, zc_attribution_field, zc_composite_prefix, zc_default_category, and zc_alias. The layer stashes a ZeroclawAttribution snapshot in the span’s extensions; no LogEvent is emitted for the span itself.
  2. record!(LEVEL, Event::new(...), "msg") — emits an event with target = "zeroclaw_log_event" carrying zc_name, zc_action, zc_outcome, zc_category, zc_attrs, zc_has_duration, zc_duration_ms, and message. The layer walks the span scope leaf→root, merges every attribution snapshot it finds, and writes a fully populated LogEvent.

Structs§

LogCaptureLayer