xecute-cli 0.1.1

NestJS-style project and resource generator for Xecute
1
2
3
4
5
6
7
8
9
10
11
12
13
use tracing_subscriber::{fmt, EnvFilter};

pub fn init() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let filter = match std::env::var("RUST_LOG") {
        Ok(value) => EnvFilter::try_new(value)?,
        Err(std::env::VarError::NotPresent) => EnvFilter::new("info"),
        Err(error) => return Err(error.into()),
    };
    fmt().with_env_filter(filter).json().with_current_span(true).try_init()?;
    // Panic payloads may contain secrets; the HTTP boundary returns a generic 500.
    std::panic::set_hook(Box::new(|_| tracing::error!("task panicked")));
    Ok(())
}