diff --git a/Cargo.toml b/Cargo.toml index 02f186c..0b351ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [features] tracker-state-debug = [] +tokio-logging = [] [dependencies] async-channel = "2.2.0" diff --git a/src/main.rs b/src/main.rs index 119dc8c..980af97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,11 +31,19 @@ fn main() -> glib::ExitCode { .with_ansi(false) .init(); } - #[cfg(debug_assertions)] + #[cfg(all(not(feature = "tokio-debug"), debug_assertions))] + { + let sub = tracing_subscriber::FmtSubscriber::new(); + if let Err(e) = tracing::subscriber::set_global_default(sub) { + panic!("Could not set tracing global: {e}"); + } + } + #[cfg(feature = "tokio-debug")] { console_subscriber::init(); } + let span = tracing::span!(Level::TRACE, "main"); let _enter = span.enter();