From 0959bf376ce65ba77ed3cd95eef358bd48ca42ab Mon Sep 17 00:00:00 2001 From: eupn <36292692+eupn@users.noreply.github.com> Date: Sat, 27 Oct 2018 20:37:03 +0300 Subject: [PATCH] Avoid stdout and panic logging when TUI is running (#1837) --- util/src/logger.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/src/logger.rs b/util/src/logger.rs index 6adadd393..3cb65c328 100644 --- a/util/src/logger.rs +++ b/util/src/logger.rs @@ -74,6 +74,12 @@ impl Filter for GrinFilter { /// Initialize the logger with the given configuration pub fn init_logger(config: Option) { if let Some(c) = config { + let tui_running = c.tui_running.unwrap_or(false); + if tui_running { + let mut tui_running_ref = TUI_RUNNING.lock(); + *tui_running_ref = true; + } + // Save current logging configuration let mut config_ref = LOGGING_CONFIG.lock(); *config_ref = c.clone(); @@ -98,7 +104,7 @@ pub fn init_logger(config: Option) { let mut appenders = vec![]; - if c.log_to_stdout { + if c.log_to_stdout && !tui_running { let filter = Box::new(ThresholdFilter::new(level_stdout)); appenders.push( Appender::builder()