[−][src]Crate color_backtrace
Colorful and clean backtraces on panic.
This library aims to make panics a little less painful by nicely colorizing them, skipping over frames of functions called after the panic was already initiated and printing relevant source snippets. Frames of functions in your application are colored in a different color (red) than those of dependencies (green).
Screenshot
Features
- Colorize backtraces to be easier on the eyes
- Show source snippets if source files are found on disk
- Print frames of application code vs dependencies in different color
- Hide all the frames after the panic was already initiated
- Hide language runtime initialization frames
Installing the panic handler
In your main function, just insert the following snippet. That's it!
color_backtrace::install();
If you want to customize some settings, you can instead do:
use color_backtrace::{install_with_settings, Settings}; install_with_settings(Settings::new().message("Custom message!"));
Controlling verbosity
The default verbosity is configured via the RUST_BACKTRACE
environment
variable. An unset RUST_BACKTRACE
corresponds to
minimal, RUST_BACKTRACE=1
to
medium and RUST_BACKTRACE=full
to
full verbosity levels.
Re-exports
pub use termcolor; |
Structs
ColorScheme | Color scheme definition. |
Settings | Configuration for panic printing. |
Enums
Verbosity | Defines how verbose the backtrace is supposed to be. |
Functions
create_panic_handler | Create a |
install | Install the |
install_with_settings | Install the |
print_backtrace | Pretty-prints a |
print_panic_info | Pretty-prints a |