diff --git a/src/main.rs b/src/main.rs index 7c9d026..3e2a9e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,7 @@ use std::{ path::Path, process::{exit, Command}, str::FromStr, + panic, }; #[macro_use] @@ -121,6 +122,11 @@ fn init_logging(level: log::LevelFilter) -> Result<(), fern::InitError> { logger.apply()?; + // Catch panics and log them instead of default output to StdErr + panic::set_hook(Box::new(|info| { + warn!("[PANIC] {}", info); + })); + Ok(()) }