Tracing Broadcast
A tracing_subscriber::Layer that fans every emitted event into a
tokio::sync::broadcast channel as a serializable [TracingFrame]
(timestamp / level / target / message / structured fields).
Features
Useful for any service that wants to expose a "tail my logs" stream
over a management API, RPC, or websocket — BroadcastTracingLayer
plugs alongside the normal tracing_subscriber::fmt::Layer, so user-
visible logging on stderr stays unchanged. Each subscriber gets its
own broadcast::Receiver with independent backlog tracking; slow
subscribers see RecvError::Lagged(n) and resume from the next
available frame.
Example
use BroadcastTracingLayer;
use SubscriberExt;
use SubscriberInitExt;
# async
TracingFrame derives serde::Serialize / Deserialize, so the
operator-facing transport (NDJSON, websocket text frames, etc.) is
just serde_json::to_string(&frame).
License
Released under the MIT License © 2026 Canmi