alert-me/src/logging.rs

15 lines
514 B
Rust
Raw Normal View History

2024-05-08 16:12:49 +00:00
use tracing::debug;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
pub(crate) fn setup(bin_name: &str) {
let default_config = format!("{}=info,tower_http=info", bin_name);
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| default_config.into()),
)
.with(tracing_subscriber::fmt::layer().with_target(true))
.init();
debug!("tracing/logging is setup");
}