bootc_internal_utils/tracing_util.rs
1//! Helpers related to tracing, used by main entrypoints
2
3/// Initialize tracing with the default configuration.
4pub fn initialize_tracing() {
5 // Don't include timestamps and such because they're not really useful and
6 // too verbose, and plus several log targets such as journald will already
7 // include timestamps.
8 let format = tracing_subscriber::fmt::format()
9 .without_time()
10 .with_target(false)
11 .compact();
12 // Log to stderr by default
13 tracing_subscriber::fmt()
14 .event_format(format)
15 .with_writer(std::io::stderr)
16 .with_max_level(tracing::Level::WARN)
17 .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
18 .init();
19}