From dcc221cb8212b4bcfe7fc0f569dce132c492be8a Mon Sep 17 00:00:00 2001 From: stringhandler Date: Wed, 11 Sep 2024 21:00:31 +0200 Subject: [PATCH] fix: fix logging --- log4rs_sample.yml | 9 --------- src/main.rs | 16 ++++++++-------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/log4rs_sample.yml b/log4rs_sample.yml index 6ed7b05..fd1e590 100644 --- a/log4rs_sample.yml +++ b/log4rs_sample.yml @@ -37,12 +37,3 @@ root: appenders: - stdout - xtrgpuminer - -loggers: - # Route log events common to every application to all appenders - tari::gpuminer: - level: info - appenders: - - stdout - - default - additive: false diff --git a/src/main.rs b/src/main.rs index f80c509..320ff6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,15 +128,15 @@ struct Cli { async fn main_inner() -> Result<(), anyhow::Error> { let cli = Cli::parse(); - if cli.log_config_file.is_some() && cli.log_dir.is_some() { - if let Err(e) = initialize_logging( - &cli.log_config_file.as_ref().cloned().unwrap_or_default(), - &cli.log_dir.as_ref().cloned().unwrap_or_default(), + if let Some(ref log_dir) = cli.log_dir { + + tari_common::initialize_logging( + &log_dir + .join("log4rs_config.yml"), + &log_dir.join("xtrgpuminer"), include_str!("../log4rs_sample.yml"), - ) { - eprintln!("Gpu main_inner error: {}", e); - return Err(e.into()); - } + ) + .expect("Could not set up logging"); } let benchmark = cli.benchmark;