From 3d74d7fe851d309d93d7e8291999c2dae916ea79 Mon Sep 17 00:00:00 2001 From: eupn <36292692+eupn@users.noreply.github.com> Date: Wed, 24 Oct 2018 19:13:57 +0300 Subject: [PATCH] Fix path to log file in panic message (#1815) --- util/src/logger.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/util/src/logger.rs b/util/src/logger.rs index 7598fb27f..6adadd393 100644 --- a/util/src/logger.rs +++ b/util/src/logger.rs @@ -74,6 +74,10 @@ impl Filter for GrinFilter { /// Initialize the logger with the given configuration pub fn init_logger(config: Option) { if let Some(c) = config { + // Save current logging configuration + let mut config_ref = LOGGING_CONFIG.lock(); + *config_ref = c.clone(); + let level_stdout = convert_log_level(&c.stdout_log_level); let level_file = convert_log_level(&c.file_log_level); let level_minimum; @@ -158,10 +162,11 @@ pub fn init_logger(config: Option) { level_file, level_stdout, level_minimum ); - // Logger configuration successfully injected into LOGGING_CONFIG... + // Mark logger as initialized let mut was_init_ref = WAS_INIT.lock(); *was_init_ref = true; } + send_panic_to_log(); } @@ -211,9 +216,11 @@ fn send_panic_to_log() { //also print to stderr let tui_running = TUI_RUNNING.lock().clone(); if !tui_running { + let config = LOGGING_CONFIG.lock(); + eprintln!( - "Thread '{}' panicked with message:\n\"{}\"\nSee grin.log for further details.", - thread, msg + "Thread '{}' panicked with message:\n\"{}\"\nSee {} for further details.", + thread, msg, config.log_file_path ); } }));