diff --git a/client/src-tauri/src/telemetry/check_triggers.rs b/client/src-tauri/src/telemetry/check_triggers.rs index 540442b..128058b 100644 --- a/client/src-tauri/src/telemetry/check_triggers.rs +++ b/client/src-tauri/src/telemetry/check_triggers.rs @@ -10,9 +10,9 @@ pub fn check_triggers( match data { network_tables::Value::Boolean(b) => { if *b != *previous_gpws { - if cfg!(debug_assertions) { - println!("gpws changed from {} to {}", previous_gpws, b); - } + #[cfg(debug_assertions)] + tracing::debug!("gpws: {}", b); + app_handle .emit_all("telemetry_gpws", b) .expect("Failed to emit telemetry_gpws event"); diff --git a/client/src-tauri/src/telemetry/create_client.rs b/client/src-tauri/src/telemetry/create_client.rs index f1987fc..cfc521c 100644 --- a/client/src-tauri/src/telemetry/create_client.rs +++ b/client/src-tauri/src/telemetry/create_client.rs @@ -37,9 +37,11 @@ pub async fn create_client( break client; // Exit the loop if the client is successfully created } Err(e) => { - if cfg!(debug_assertions) { - println!("Failed to create client: {}. Retrying in 3 seconds...", e); - } + tracing::debug!( + message = "Failed to create client. Retrying in 3 seconds...", + error = %e, + rate_limit = "3s", + ); app_handle .emit_all("telemetry_status", "disconnected") .expect("Failed to emit telemetry_status disconnected event"); diff --git a/client/src-tauri/src/telemetry/create_subscription.rs b/client/src-tauri/src/telemetry/create_subscription.rs index c9ab0b5..db45bcf 100644 --- a/client/src-tauri/src/telemetry/create_subscription.rs +++ b/client/src-tauri/src/telemetry/create_subscription.rs @@ -32,9 +32,8 @@ pub async fn create_subscription(client: &Client) -> Result break Ok(subscription), Err(e) => { - if cfg!(debug_assertions) { - println!("Failed to create subscription: {}", e); - } + #[cfg(debug_assertions)] + tracing::warn!("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 2db5c7d..f3c72e3 100644 --- a/client/src-tauri/src/telemetry/mod.rs +++ b/client/src-tauri/src/telemetry/mod.rs @@ -59,13 +59,12 @@ pub async fn subscribe_topics( }; } - if cfg!(debug_assertions) { - println!("{}", json_message); - } - } - if cfg!(debug_assertions) { - println!("disconnected"); + #[cfg(debug_assertions)] + tracing::debug!("{}", json_message); } + + #[cfg(debug_assertions)] + tracing::debug!("disconnected"); app_handle .emit_all("telemetry_status", "disconnected") .expect("Failed to emit telemetry_disconnected event");