| Crates.io | crashy |
| lib.rs | crashy |
| version | 0.4.0 |
| created_at | 2023-12-10 22:01:15.669336+00 |
| updated_at | 2025-03-28 15:18:20.24119+00 |
| description | crash reporting with nicer stack traces and information about the current process, with optional Sentry integration |
| homepage | https://www.bitpowder.com/libs/indigo/ |
| repository | https://gitlab.com/bitpowder/indigo-ng |
| max_upload_size | |
| id | 1064553 |
| size | 86,985 |
A small crash library that prints that either:
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:
sentry to enable Sentry upload (SENTRY_DSN environment variable during build is also needed, see above);trace to enable reporting of OpenTelemetry tracing and span ids.