feat(dtmm): Improve logging output format

This commit is contained in:
Lucas Schwiderski 2023-02-17 23:00:18 +01:00
parent 16bfe88101
commit 8b2ca0e45a
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -21,10 +21,22 @@ async fn main() -> Result<()> {
let _matches = command!().get_matches();
{
let fmt_layer = tracing_subscriber::fmt::layer().pretty();
let filter_layer =
EnvFilter::try_from_default_env().or_else(|_| EnvFilter::try_new("info"))?;
if cfg!(debug_assertions) {
let fmt_layer = tracing_subscriber::fmt::layer().pretty();
tracing_subscriber::registry()
.with(filter_layer)
.with(fmt_layer)
.with(ErrorLayer::new(
tracing_subscriber::fmt::format::Pretty::default(),
))
.init();
} else {
let fmt_layer = tracing_subscriber::fmt::layer().compact();
tracing_subscriber::registry()
.with(filter_layer)
.with(fmt_layer)
@ -33,6 +45,7 @@ async fn main() -> Result<()> {
))
.init();
}
}
let initial_state = State::new();