1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
# better-panic
[](https://github.com/mitsuhiko/better-panic/actions?query=workflow%3ATests)
[](https://crates.io/crates/better-panic)
[](https://github.com/mitsuhiko/better-panic/blob/master/LICENSE)
[](https://img.shields.io/badge/rust-1.42%2B-orange.svg)
[](https://docs.rs/better-panic)
`better-panic` gives you pretty backtraces for panics.
It is inspired by Python tracebacks and tries to replicate them as well
as possible. This is what it looks like:
<img src="https://github.com/mitsuhiko/better-panic/raw/master/screenshot.png">
Some of the code is based on the
[color-backtrace](https://crates.io/crates/color-backtrace) library.
## Usage
The most common way to use it is to invoke the `install` function
which installs a panic handler. In debug builds the backtrace is shown
automatically, in release builds it's hidden by default.
```rust
better_panic::install();
```
For more configuration see the `Settings` object.
## Features
- Colorize backtraces to be easier on the eyes
- Show source snippets if source files are found on disk
- Hide all the frames after the panic was already initiated
## License and Links
- [Documentation](https://docs.rs/better-panic/)
- [Issue Tracker](https://github.com/mitsuhiko/better-panic/issues)
- [Examples](https://github.com/mitsuhiko/better-panic/tree/master/examples)
- License: [MIT](https://github.com/mitsuhiko/better-panic/blob/master/LICENSE)
|