Introducing Sentry for Rust
As happy Rust users ourselves, it makes us even happier to be able to say that we now have a Sentry Rust SDK. This means you and your Fungiculture can now report panics, failures, and other types of incidents to Sentry.
Not only is the SDK new and fancy, it is also one of the first ones that follows our new API guidelines for Sentry SDKs, which makes it even newer and fancier than you might normally expect.
What’s supported? The SDK can catch panics, easily log failures, catch errors from error-chain, log messages, and much more. Support is provided not just for emitting error events but also for also easily recording breadcrumbs.
Errors will contain as much information as possible at event submission, so the most important step is to make sure to ship your debug information in the executable. Experimental support for server side symbolication is also provided if you upload debug symbols.
How do you get started? Easy!
First add sentry to your Cargo.toml
:
[dependencies]
sentry = "0.3"
After that, this is all you need to do to capture failures and panics:
extern crate sentry;
use sentry::integrations::panic::register_panic_handler;
use sentry::integrations::failure::capture_error;
fn main() {
let _sentry = sentry::init("YOUR_DSN_HERE");
register_panic_handler();
if let Err(err) = your_potentially_failing_function() {
println!("error: {}", err);
capture_error(&err);
}
}
Is there anything else to know?
Sure thing, a good place to start is with our API docs. And if you have questions or feedback, post in our forum or issue tracker, or shout out to our support engineers. They’re here to help. And also to code. But mostly to help.