diff options
Diffstat (limited to 'crates/daemon')
| -rw-r--r-- | crates/daemon/src/main.rs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/crates/daemon/src/main.rs b/crates/daemon/src/main.rs index 8fd3c119..d157d075 100644 --- a/crates/daemon/src/main.rs +++ b/crates/daemon/src/main.rs @@ -43,21 +43,6 @@ enum Cmd { #[tokio::main] async fn main() -> Result<()> { - if let Err(e) = tracing_subscriber::fmt() - .with_file(true) - .with_line_number(true) - .with_level(true) - .without_time() - .with_env_filter( - EnvFilter::builder() - .from_env_lossy() - .add_directive("turtle_daemon=debug".parse().unwrap()), - ) - .try_init() - { - eprintln!("failed to initialize logging: {e}"); - } - let settings = Settings::new().wrap_err("could not load client settings")?; if !settings.paths_ok() { bail!("Failed to verify all paths :("); @@ -70,7 +55,25 @@ async fn main() -> Result<()> { let sqlite_store = SqliteStore::new(record_store_path, settings.local_timeout).await?; match Cmd::parse() { - Cmd::Start { show_logs, .. } => boot(settings, sqlite_store, history_db).await, + Cmd::Start { show_logs, .. } => { + if show_logs + && let Err(e) = tracing_subscriber::fmt() + .with_file(true) + .with_line_number(true) + .with_level(true) + .without_time() + .with_env_filter( + EnvFilter::builder() + .from_env_lossy() + .add_directive("turtle_daemon=debug".parse().unwrap()), + ) + .try_init() + { + eprintln!("failed to initialize logging: {e}"); + } + + boot(settings, sqlite_store, history_db).await + } } } |
