7 unstable releases
| new 0.4.2 | Jan 18, 2026 |
|---|---|
| 0.4.1 |
|
| 0.4.0 | Mar 28, 2025 |
| 0.3.2 | Nov 11, 2024 |
| 0.1.0 | Dec 10, 2023 |
#1069 in Debugging
Used in tmuxstatus
64KB
1K
SLoC
crashy
A small crash library that prints that either:
- prints nicer colored crash traces (that are readable, and contain information like command line arguments), or
- sends the crash data to sentry (but with minimal dependencies).
Additional it adjusts the console log format to systemd format, so that log severity levels are recognized and the time is omitted (as time is already included in systemd).
It aims to be a small library that covers most (but not all) crash reporting. It reports also the OpenTelemetry TraceId and SpandId if available and the feature trace is enabled.
To set up crashy, in your main function, add:
let _crash_handler = crashy::setup_crashy(); // do not rename variable to `_` as this will affect the lifetime
To use the Sentry integration, enable feature sentry and define the environment variable SENTRY_DSN during building (using env SENTRY_DSN=https://... cargo build), and adjust the set up to one of these two functions:
Sentry integration sync version (will spawn a new thread to transmit the crash report):
let crashy_options = crashy::CrashyOptions::default_sync();
let _crash_handler = crashy::setup_crashy_with_options(crashy_options);
Sentry integration async version with Tokio (will spawn a new Tokio task to transmit the crash report):
let _crash_handler = crashy::setup_crashy_with_options(crashy_options);
let crashy_options = crashy::CrashyOptions::default_async(tokio::runtime::Handle::current());
To get nicer stacktraces, compile to remap paths in the stacktrace to more readable versions. Do this with env RUSTFLAGS=--remap-path-prefix=pwd/= cargo build
Features:
sentryto enable Sentry upload (SENTRY_DSNenvironment variable during build is also needed, see above);traceto enable reporting of OpenTelemetry tracing and span ids.
Dependencies
~5–21MB
~251K SLoC