This crate provides support for logging events and errors / panics to the Sentry error logging service. It integrates with the standard panic system in Rust as well as a few popular error handling setups.
sentry::init function returns a guard that when dropped will flush Events that were not
yet sent to the sentry service. It has a two second deadline for this so shutdown of
applications might slightly delay as a result of this. Keep the guard around or sending events
will not work.
let _guard = sentry::init("https://email@example.com/42"); sentry::capture_message("Hello World!", sentry::Level::Info); // when the guard goes out of scope here, the client will wait up to two // seconds to send remaining events to the service.
What makes this crate useful are the various integrations that exist. Some of them are enabled by default, some uncommon ones or for deprecated parts of the ecosystem a feature flag needs to be enabled. For the available integrations and how to use them see integrations and apply_defaults.
This crate comes fully featured. If the goal is to instrument libraries for usage
with sentry, or to extend sentry with a custom
Integration or a
one should use the
sentry-core crate instead.
Functionality of the crate can be turned on and off by feature flags. This is the current list of feature flags:
backtrace: Enables backtrace support.
contexts: Enables capturing device, os, and rust contexts.
panic: Enables support for capturing panics.
transport: Enables the default transport, which is currently
anyhow: Enables support for the
debug-images: Attaches a list of loaded libraries to events (currently only supported on unix).
log: Enables support for the
env_logger: Enables support for the
logcrate with additional
slog: Enables support for the
test: Enables testing support.
debug-logs: Uses the
logcrate for internal logging.
reqwest: Enables the
reqwesttransport, which is currently the default.
curl: Enables the curl transport.
surf: Enables the surf transport.
native-tls: Uses the
native-tlscrate, which is currently the default. This only has an effect on the
rustls: Enables the
rustlssupport of the
reqwesttransport. Please note that
native-tlsis a default feature, and one needs to use
default-features = falseto completely disable building
Available Sentry Integrations.
The current latest sentry protocol version.
This provides testing functionality for building tests.
The provided transports.
This crate provides common types for working with the Sentry protocol or the Sentry server. It's used by the Sentry Relay infrastructure as well as the rust Sentry client.
Returns the intended release for Sentry as an
Represents a single breadcrumb.
The Sentry Client.
Helper struct that is returned from
Configuration settings for the client.
A Sentry Envelope.
The central object that can manages scopes and clients.
Holds contextual data for the current scope.
A scope guard.
A future that binds a
Represents user info.
Represents the level of severity of an event or breadcrumb.
A helper trait that converts self into an Iterator of Breadcrumbs.
Helper trait to convert a string into an
Future extensions for Sentry.
The trait for transports.
A factory creating transport instances.
Records a breadcrumb by calling a function.
Apply default client options.
Captures an event on the currently active client if any.
Captures an arbitrary message.
Invokes a function that can modify the current scope.
End the current Release Health Session.
End the current Release Health Session with the given
Create a sentry
Creates the Sentry client for a given client config and binds it.
Returns the last event ID captured.
Parse the types name from
Start a new session for Release Health.
Looks up an integration on the current Hub.
Temporarily pushes a scope for a single call optionally reconfiguring it.