15 lines
319 B
Rust
15 lines
319 B
Rust
|
use std::{panic, process};
|
||
|
|
||
|
pub fn exit_on_panic() {
|
||
|
let orig_hook = panic::take_hook();
|
||
|
panic::set_hook(Box::new(move |panic_info| {
|
||
|
// invoke the default handler and exit the process
|
||
|
orig_hook(panic_info);
|
||
|
process::exit(1);
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
pub fn init_logger() {
|
||
|
env_logger::init();
|
||
|
}
|