Expand description
Process-wide diagnostics: capture every WARN+ tracing event and panic.
Each one ends up in (a) the rolling log file, (b) a global ring buffer
surfaced through MetricsSnapshot → the F12 panel and fmf stats, and
(c) any registered sinks (the FFI forwards them as ENGINE_ERROR events
to the UI).
The layer responsible for the “don’t go silent” arm of
“don’t crash / don’t hang / don’t go silent”.
Structs§
- Diag
Layer - Routes WARN/ERROR tracing events into the diagnostics ring + sinks.
Events with
target: "panic"are classified as panics. - Error
Event - One captured diagnostic event: the unit stored in the ring and fanned out to sinks.
- Field
Grab 🔒 - Sink
Guard - Lifetime handle for a registered sink; dropping it unregisters the sink.
Enums§
- Severity
- Severity class of a captured diagnostic event, in ascending order.
Constants§
- RING_
CAP 🔒
Statics§
Functions§
- error_
chain - Full error cause chain as one line.
- init_
diag - The one diagnostics bootstrap: file/stderr logging + panic capture +
diag-ring wiring, idempotent — FFI
fmf_engine_create, the service entry points and the CLI all call exactly this (ADR-0018). - init_
logging - Initialize process-wide logging once.
- install_
panic_ hook - Route every panic (any thread) through tracing with a backtrace, so it reaches the log file, the ring and the UI. Idempotent.
- recent_
errors - Snapshot of the diagnostics ring (oldest first), capped at the ring size.
- record
- Record one diagnostic event (ring + sinks). Normally reached via the tracing layer rather than called directly.
- register_
sink - Register a fan-out target for new error events; dropping the guard unregisters it (the FFI ties this to the engine handle’s lifetime).
- resolve_
log_ dir - Resolves the engine log directory.
Type Aliases§
- Sink 🔒