diff --git a/client/src-tauri/.env b/client/src-tauri/.env new file mode 100644 index 0000000..de3130c --- /dev/null +++ b/client/src-tauri/.env @@ -0,0 +1 @@ +RUST_LOG= \ No newline at end of file diff --git a/client/src-tauri/src/main.rs b/client/src-tauri/src/main.rs index 82fab0f..1d0aca9 100644 --- a/client/src-tauri/src/main.rs +++ b/client/src-tauri/src/main.rs @@ -3,6 +3,7 @@ use tauri::Manager; mod telemetry; +use tracing_subscriber::FmtSubscriber; #[derive(Clone, serde::Serialize)] struct Payload { @@ -15,6 +16,12 @@ const NTABLE_PORT: u16 = 5810; fn main() { let rt = tokio::runtime::Runtime::new().expect("Failed to create Tokio runtime"); + // set the environment variable RUST_LOG to debug in order to see debug messages + let subscriber = FmtSubscriber::builder() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .finish(); + tracing::subscriber::set_global_default(subscriber).unwrap(); + rt.block_on(async { tauri::Builder::default() .setup(|app| { diff --git a/client/src-tauri/src/telemetry/check_triggers.rs b/client/src-tauri/src/telemetry/check_triggers.rs index 128058b..499b116 100644 --- a/client/src-tauri/src/telemetry/check_triggers.rs +++ b/client/src-tauri/src/telemetry/check_triggers.rs @@ -10,7 +10,6 @@ pub fn check_triggers( match data { network_tables::Value::Boolean(b) => { if *b != *previous_gpws { - #[cfg(debug_assertions)] tracing::debug!("gpws: {}", b); app_handle diff --git a/client/src-tauri/src/telemetry/create_subscription.rs b/client/src-tauri/src/telemetry/create_subscription.rs index db45bcf..4fd29e4 100644 --- a/client/src-tauri/src/telemetry/create_subscription.rs +++ b/client/src-tauri/src/telemetry/create_subscription.rs @@ -32,8 +32,7 @@ pub async fn create_subscription(client: &Client) -> Result break Ok(subscription), Err(e) => { - #[cfg(debug_assertions)] - tracing::warn!("Failed to create subscription: {:?}", e); + tracing::debug!("Failed to create subscription: {:?}", e); if attempts >= 50 { break Err(e); diff --git a/client/src-tauri/src/telemetry/mod.rs b/client/src-tauri/src/telemetry/mod.rs index f3c72e3..f6c2d9d 100644 --- a/client/src-tauri/src/telemetry/mod.rs +++ b/client/src-tauri/src/telemetry/mod.rs @@ -59,11 +59,9 @@ pub async fn subscribe_topics( }; } - #[cfg(debug_assertions)] tracing::debug!("{}", json_message); } - #[cfg(debug_assertions)] tracing::debug!("disconnected"); app_handle .emit_all("telemetry_status", "disconnected")