template-rust-project 0.2.4

A template for Rust projects
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ctor::ctor;
use tracing::Level;
use tracing_subscriber;

#[ctor]
fn set_debug_level() {
    // If DEBUG_PROJ is not set or set to false, disable logging. Otherwise, enable logging
    if std::env::var("DEBUG_PROJ").map_or(true, |v| v == "0" || v == "false" || v.is_empty()) {
        // Disable logging
    } else {
        tracing_subscriber::fmt()
            .with_max_level(Level::DEBUG)
            .init();
    }

    //println!("DEBUG_PROJ: {:?}", std::env::var("DEBUG_PROJ"));
}