Skip to main content

rolter_core/
telemetry.rs

1use tracing_subscriber::{fmt, prelude::*, EnvFilter};
2
3/// Initialize the global tracing subscriber.
4///
5/// Reads the `RUST_LOG` environment variable for filtering and falls back to
6/// `info`. Safe to call more than once; subsequent calls are ignored.
7pub fn init() {
8    let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
9    let _ = tracing_subscriber::registry()
10        .with(filter)
11        .with(fmt::layer())
12        .try_init();
13}