From 047a180664af6a11ea02e3d19b6ae63e22d76e38 Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Thu, 4 Jul 2024 09:03:17 -0700 Subject: [PATCH] added debug console logging --- Cargo.toml | 1 + src/main.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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();