This commit is contained in:
Brad Stein 2025-06-16 00:05:39 -05:00
parent 6c0327dbf3
commit 91e761d5ef
2 changed files with 37 additions and 37 deletions

View File

@ -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(
// componentlevel 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();
}

View File

@ -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(
// componentlevel 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();