-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or request
Description
By adding panic hook that logs the panic and then return to the default panic handler would be useful for debugging when users who manage to crash the application require assistance. This could possibly be implemented as bellow
use std::panic;
use log::*;
let default_panic = panic::take_hook()
panic::set_hook(Box::new(|info| {
error!("{}",info);
default_panic(info);
}));Its behavior can be updated to open the log file on panic, might be useful if its distributed as a gui application.
The opener crate open a file with the os default application https://docs.rs/opener/latest/opener/fn.open.html#
use std::panic;
use log::*;
use opener::open;
let default_panic = panic::take_hook()
panic::set_hook(Box::new(|info| {
error!("{}",info);
open("../output.log");
default_panic(info);
}));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request