#[cfg(feature = "logging")]
use tracing_subscriber::{EnvFilter, fmt};
#[cfg(feature = "logging")]
pub fn init() {
init_with_level("info")
}
#[cfg(feature = "logging")]
pub fn init_with_level(level: &str) {
let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(level));
fmt()
.with_env_filter(filter)
.with_target(true)
.with_thread_ids(true)
.with_line_number(true)
.init();
}
#[cfg(feature = "logging")]
pub fn init_test() {
let _ = fmt()
.with_env_filter(EnvFilter::new("debug"))
.with_test_writer()
.try_init();
}
#[cfg(not(feature = "logging"))]
pub fn init() {}
#[cfg(not(feature = "logging"))]
pub fn init_with_level(_level: &str) {}
#[cfg(not(feature = "logging"))]
pub fn init_test() {}