refactor: remove redundant debug checks from tracing
This commit is contained in:
parent
884014e810
commit
733e798717
5 changed files with 9 additions and 5 deletions
1
client/src-tauri/.env
Normal file
1
client/src-tauri/.env
Normal file
|
@ -0,0 +1 @@
|
|||
RUST_LOG=
|
|
@ -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| {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,8 +32,7 @@ pub async fn create_subscription(client: &Client) -> Result<Subscription, networ
|
|||
match subscription_attempt {
|
||||
Ok(subscription) => 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);
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue