okstd 2.0.1

The standard library that's ok
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::error::Error;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::fmt;

pub fn setup_logging(level: LevelFilter) -> Result<(), Box<dyn Error>> {
    // construct a subscriber that prints formatted traces to stdout
    let subscriber = fmt::Subscriber::builder()
        .with_max_level(level)
        .finish();

    // use that subscriber to process traces emitted after this point
    tracing::subscriber::set_global_default(subscriber)?;

    Ok(())
}