arqen 0.1.0

Backend infrastructure for agent-ready applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use tracing_subscriber::{EnvFilter, fmt};

pub fn init_logging(log_level: &str, log_format: &str) {
    let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(log_level));

    match log_format {
        "json" => {
            fmt().with_env_filter(filter).json().init();
        }
        "pretty" => {
            fmt().with_env_filter(filter).pretty().init();
        }
        _ => {
            fmt().with_env_filter(filter).init();
        }
    }
}