diff --git a/client/src/main.rs b/client/src/main.rs index 7eff8e4..07bae98 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -12,6 +12,24 @@ use tracing_subscriber::{fmt, EnvFilter}; #[tokio::main] async fn main() -> Result<()> { + tracing_subscriber::fmt() + .with_env_filter( + // honour RUST_LOG but fall back to very chatty defaults + EnvFilter::try_from_default_env().unwrap_or_else(|_| { + EnvFilter::new( + "navka_client=trace,\ + navka_server=trace,\ + tonic=debug,\ + h2=debug,\ + tower=debug", + ) + }), + ) + .with_target(true) + .with_thread_ids(true) + .with_file(true) + .init(); + let dev_mode = env::var("NAVKA_DEV_MODE").is_ok(); if dev_mode { @@ -38,21 +56,4 @@ async fn main() -> Result<()> { let mut app = NavkaClientApp::new()?; app.run().await -} - -fmt!() - .with_env_filter( - // honour RUST_LOG but fall back to very chatty defaults - EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new( - // component‑level granularity - "navka_client=trace,\ - navka_server=trace,\ - tonic=debug,\ - h2=debug,\ - tower=debug")) - ) - .with_target(true) // show module path - .with_thread_ids(true) - .with_file(true) - .init(); +} \ No newline at end of file diff --git a/server/src/main.rs b/server/src/main.rs index 3aa9c5e..c8263e2 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -6,7 +6,7 @@ use std::{pin::Pin, sync::Arc}; use tokio::{fs::{File, OpenOptions}, io::AsyncWriteExt, sync::Mutex}; use tokio_stream::{wrappers::ReceiverStream, Stream, StreamExt}; use tonic::{transport::Server, Request, Response, Status}; -use tracing::{info, error}; +use tracing::{error, info, trace}; use tracing_subscriber::{fmt, EnvFilter}; use navka_common::navka::{ @@ -70,7 +70,23 @@ impl Relay for Handler { #[tokio::main] async fn main() -> anyhow::Result<()> { - tracing_subscriber::fmt::init(); + tracing_subscriber::fmt() + .with_env_filter( + // honour RUST_LOG but fall back to very chatty defaults + EnvFilter::try_from_default_env().unwrap_or_else(|_| { + EnvFilter::new( + "navka_client=trace,\ + navka_server=trace,\ + tonic=debug,\ + h2=debug,\ + tower=debug", + ) + }), + ) + .with_target(true) + .with_thread_ids(true) + .with_file(true) + .init(); let kb = OpenOptions::new() .write(true) @@ -98,20 +114,3 @@ async fn main() -> anyhow::Result<()> { .await?; Ok(()) } - -fmt!() - .with_env_filter( - // honour RUST_LOG but fall back to very chatty defaults - EnvFilter::try_from_default_env() - .unwrap_or_else(|_| EnvFilter::new( - // component‑level granularity - "navka_client=trace,\ - navka_server=trace,\ - tonic=debug,\ - h2=debug,\ - tower=debug")) - ) - .with_target(true) // show module path - .with_thread_ids(true) - .with_file(true) - .init();