From cae50ffdf43a9de94bb27fdf40876c062768f2f8 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 23 Nov 2023 09:08:35 +0100 Subject: [PATCH] CLI: add error logs to console output (#1667) --- cli/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index df31b1d5c8..52affa93f4 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -8,6 +8,7 @@ mod wallet_cli; use clap::Parser; use fern_logger::{LoggerConfigBuilder, LoggerOutputConfigBuilder}; +use log::LevelFilter; use self::{ cli::{new_wallet, Cli}, @@ -35,12 +36,20 @@ fn logger_init(cli: &Cli) -> Result<(), Error> { println_log_error!("{panic_info}"); })); + let target_exclusions = &["rustls"]; let archive = LoggerOutputConfigBuilder::default() .name("archive.log") .level_filter(cli.log_level) - .target_exclusions(&["rustls"]) + .target_exclusions(target_exclusions) .color_enabled(false); - let config = LoggerConfigBuilder::default().with_output(archive).finish(); + let console = LoggerOutputConfigBuilder::default() + .level_filter(LevelFilter::Error) + .target_exclusions(target_exclusions) + .color_enabled(true); + let config = LoggerConfigBuilder::default() + .with_output(archive) + .with_output(console) + .finish(); fern_logger::logger_init(config)?;