A crate to make debugging unexpected panics easier both on developer and consumer machines. Provides a panic handler which generates a helpful panic message and saves a backtrace, system information and minidump to a file.
colored_panic_message
.Exit
, Abort
, Loop
.``` use std::panic;
fn main() {
panic::sethook(Box::new(|panicinfo: &panic::PanicInfo| {
let panichandlingconfig = oopsie-woopsie::PanicHandlingConfig {
terminationmethod: "exit".tostring(), // The method used to terminate the program. Possible values: Exit
, Abort
, Loop
.
terminationexitcode: Some(101), // The returned error code when termination method Exit
is used. Defaults to exit code 101.
panicinfologfiledestination: "C:/some/path/panic.txt".tostring(), // The path where to place the panic info log file.
minidumpfiledestination: "C:/some/path/panic.mdmp".to_string(), // The path where to place the minidump file. Will be ignored if feature write_minidump
is disabled.
};
// Replaces the default panic handler with the custom made one.
oopsie-woopsie::handle_error(
panicinfo,
panic_handling_config,
Some(std::backtrace::Backtrace::force_capture()), // If you don't want to capture a backtrace, set this to `None`.
);
}));
} ```
write_panic_log
and write-minidump
)``` [PANIC HANDLER INFO] Writing panic info.
A panic occured!
Panic location: file "src\main.rs" - line 20 column 5. Panic payload: a very interesting panic message right here.
[PANIC HANDLER INFO] Attempted to write panic info. Status: Ok(()). [PANIC HANDLER INFO] Reading system info. [PANIC HANDLER INFO] Read system info. [PANIC HANDLER INFO] Writing information to panic log file "C:/some/path/panic.txt". [PANIC HANDLER INFO] Attempted to write panic log file. Status: Ok(()). [PANIC HANDLER INFO] Writing minidump file to "C:/some/path/panic.mdmp" [PANIC HANDLER INFO] Attempted to write minidump file. Status: Ok(()). ```