mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Fix path to log file in panic message (#1815)
This commit is contained in:
parent
c343c65051
commit
3d74d7fe85
1 changed files with 10 additions and 3 deletions
|
@ -74,6 +74,10 @@ impl Filter for GrinFilter {
|
||||||
/// Initialize the logger with the given configuration
|
/// Initialize the logger with the given configuration
|
||||||
pub fn init_logger(config: Option<LoggingConfig>) {
|
pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
if let Some(c) = config {
|
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_stdout = convert_log_level(&c.stdout_log_level);
|
||||||
let level_file = convert_log_level(&c.file_log_level);
|
let level_file = convert_log_level(&c.file_log_level);
|
||||||
let level_minimum;
|
let level_minimum;
|
||||||
|
@ -158,10 +162,11 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||||
level_file, level_stdout, level_minimum
|
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();
|
let mut was_init_ref = WAS_INIT.lock();
|
||||||
*was_init_ref = true;
|
*was_init_ref = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_panic_to_log();
|
send_panic_to_log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +216,11 @@ fn send_panic_to_log() {
|
||||||
//also print to stderr
|
//also print to stderr
|
||||||
let tui_running = TUI_RUNNING.lock().clone();
|
let tui_running = TUI_RUNNING.lock().clone();
|
||||||
if !tui_running {
|
if !tui_running {
|
||||||
|
let config = LOGGING_CONFIG.lock();
|
||||||
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Thread '{}' panicked with message:\n\"{}\"\nSee grin.log for further details.",
|
"Thread '{}' panicked with message:\n\"{}\"\nSee {} for further details.",
|
||||||
thread, msg
|
thread, msg, config.log_file_path
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue