[][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

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

Installing the panic handler

In your main function, just insert the following snippet. That's it!

color_backtrace::install();

Controlling verbosity

The 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.

Enums

Verbosity

Defines how verbose the backtrace is supposed to be.

Functions

create_panic_handler

Create a color_backtrace panic handler.

get_verbosity

Query the verbosity level.

install

Install the color_backtrace handler, by calling std::panic::set_hook.