kutil_cli/
tracing.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use anstream::stderr;

/// Initialize a tracing subscriber.
pub fn tracing(verbosity: u8) {
    let level = match verbosity {
        0 => tracing::Level::WARN,
        1 => tracing::Level::INFO,
        2 => tracing::Level::DEBUG,
        _ => tracing::Level::TRACE,
    };

    tracing_subscriber::fmt().with_writer(stderr).with_max_level(level).init();
}