11//! This crate provides support for logging events and errors / panics to the
2- //! [Sentry](https://sentry.io/) error logging service. It integrates with the standard panic
2+ //! [Sentry] error logging service. It integrates with the standard panic
33//! system in Rust as well as a few popular error handling setups.
44//!
5+ //! [Sentry]: https://sentry.io/
6+ //!
57//! # Quickstart
68//!
7- //! The most convenient way to use this library is the [`sentry::init`] function,
9+ //! The most convenient way to use this library is via the [`sentry::init`] function,
810//! which starts a sentry client with a default set of integrations, and binds
911//! it to the current [`Hub`].
1012//!
1113//! The [`sentry::init`] function returns a guard that when dropped will flush Events that were not
12- //! yet sent to the sentry service. It has a two second deadline for this so shutdown of
13- //! applications might slightly delay as a result of this. Keep the guard around or sending events
14+ //! yet sent to the sentry service. It has a two second deadline for this so shutdown of
15+ //! applications might slightly delay as a result of this. Keep the guard around or sending events
1416//! will not work.
1517//!
16- //! ```
18+ //! ```rust
1719//! let _guard = sentry::init("https://key@sentry.io/42");
1820//! sentry::capture_message("Hello World!", sentry::Level::Info);
1921//! // when the guard goes out of scope here, the client will wait up to two
2022//! // seconds to send remaining events to the service.
2123//! ```
2224//!
25+ //! More complex examples on how to use sentry can also be found in [examples]. Extended instructions
26+ //! may also be found on [Sentry itself].
27+ //!
2328//! [`sentry::init`]: fn.init.html
2429//! [`Hub`]: struct.Hub.html
30+ //! [examples]: https://github.com/getsentry/sentry-rust/tree/master/sentry/examples
31+ //! [Sentry itself]: https://docs.sentry.io/platforms/rust
2532//!
2633//! # Integrations
2734//!
28- //! What makes this crate useful are the various integrations that exist. Some of them are enabled
29- //! by default, some uncommon ones or for deprecated parts of the ecosystem a feature flag needs to
30- //! be enabled. For the available integrations and how to use them see
31- //! [integrations](integrations/index.html) and [apply_defaults](fn.apply_defaults.html).
35+ //! What makes this crate useful are its various integrations. Some of them are enabled by
36+ //! default; See [Features]. Uncommon integrations or integrations for deprecated parts of
37+ //! the ecosystem require a feature flag. For available integrations and how to use them, see
38+ //! [integrations] and [apply_defaults].
39+ //!
40+ //! [Features]: #features
41+ //! [integrations]: integrations/index.html
42+ //! [apply_defaults]: fn.apply_defaults.html
3243//!
3344//! # Minimal API
3445//!
35- //! This crate comes fully featured. If the goal is to instrument libraries for usage
46+ //! This crate comes fully- featured. If the goal is to instrument libraries for usage
3647//! with sentry, or to extend sentry with a custom [`Integration`] or a [`Transport`],
3748//! one should use the [`sentry-core`] crate instead.
3849//!
4253//!
4354//! # Features
4455//!
45- //! Functionality of the crate can be turned on and off by feature flags. This is the current list
46- //! of feature flags:
47- //!
48- //! Default features:
49- //!
50- //! * `backtrace`: Enables backtrace support.
51- //! * `contexts`: Enables capturing device, os, and rust contexts.
52- //! * `panic`: Enables support for capturing panics.
53- //! * `transport`: Enables the default transport, which is currently `reqwest` with `native-tls`.
54- //!
55- //! Additional features:
56- //!
57- //! * `anyhow`: Enables support for the `anyhow` crate.
58- //! * `debug-images`: Attaches a list of loaded libraries to events (currently only supported on unix).
59- //! * `log`: Enables support for the `log` and `env_logger` crate.
60- //! * `slog`: Enables support for the `slog` crate.
61- //! * `tracing`: Enables support for the `tracing` crate.
62- //! * `test`: Enables testing support.
63- //! * `debug-logs`: Uses the `log` crate for internal logging.
64- //! * `reqwest`: Enables the `reqwest` transport, which is currently the default.
65- //! * `curl`: Enables the curl transport.
66- //! * `surf`: Enables the surf transport.
67- //! * `native-tls`: Uses the `native-tls` crate, which is currently the default.
68- //! This only has an effect on the `reqwest` transport.
69- //! * `rustls`: Enables the `rustls` support of the `reqwest` transport.
70- //! Please note that `native-tls` is a default feature, and one needs to use
71- //! `default-features = false` to completely disable building `native-tls` dependencies.
72-
56+ //! Additional functionality and integrations are enabled via feature flags. Some features require
57+ //! extra setup to function properly.
58+ //!
59+ //! | Feature | Default | Is Integration | Deprecated | Additional notes |
60+ //! | -------------- | ------- | -------------- | ---------- | ---------------------------------------------------------------------------------------- |
61+ //! | `backtrace` | ✅ | 🔌 | | |
62+ //! | `contexts` | ✅ | 🔌 | | |
63+ //! | `panic` | ✅ | 🔌 | | |
64+ //! | `transport` | ✅ | | | |
65+ //! | `anyhow` | | 🔌 | | |
66+ //! | `test` | | | | |
67+ //! | `debug-images` | | 🔌 | | |
68+ //! | `log` | | 🔌 | | Requires extra setup; See [`sentry-log`]'s documentation. |
69+ //! | `debug-logs` | | | ❗ | Requires extra setup; See [`sentry-log`]'s documentation. |
70+ //! | `slog` | | 🔌 | | Requires extra setup; See [`sentry-slog`]'s documentation. |
71+ //! | `reqwest` | ✅ | | | |
72+ //! | `native-tls` | ✅ | | | `reqwest` must be enabled. |
73+ //! | `rustls` | | | | `reqwest` must be enabled. `native-tls` must be disabled via `default-features = false`. |
74+ //! | `curl` | | | | |
75+ //! | `surf` | | | | |
76+ //!
77+ //! [`sentry-log`]: https://crates.io/crates/sentry-log
78+ //! [`sentry-slog`]: https://crates.io/crates/sentry-slog
79+ //!
80+ //! ## Default features
81+ //! - `backtrace`: Enables backtrace support.
82+ //! - `contexts`: Enables capturing device, OS, and Rust contexts.
83+ //! - `panic`: Enables support for capturing panics.
84+ //! - `transport`: Enables the default transport, which is currently `reqwest` with `native-tls`.
85+ //!
86+ //! ## Debugging/Testing
87+ //! - `anyhow`: Enables support for the `anyhow` crate.
88+ //! - `test`: Enables testing support.
89+ //! - `debug-images`: Attaches a list of loaded libraries to events (currently only supported on Unix).
90+ //!
91+ //! ## Logging
92+ //! - `log`: Enables support for the `log` crate.
93+ //! - `slog`: Enables support for the `slog` crate.
94+ //! - `debug-logs`: **Deprecated**. Uses the `log` crate for internal logging.
95+ //!
96+ //! ## Transports
97+ //! - `reqwest`: **Default**. Enables the `reqwest` transport.
98+ //! - `native-tls`: **Default**. Uses the `native-tls` crate. This only affects the `reqwest` transport.
99+ //! - `rustls`: Enables `rustls` support for `reqwest`. Please note that `native-tls` is a default
100+ //! feature, and `default-features = false` must be set to completely disable building `native-tls`
101+ //! dependencies.
102+ //! - `curl`: Enables the curl transport.
103+ //! - `surf`: Enables the surf transport.
73104#![ doc( html_favicon_url = "https://sentry-brand.storage.googleapis.com/favicon.ico" ) ]
74105#![ doc( html_logo_url = "https://sentry-brand.storage.googleapis.com/sentry-glyph-black.png" ) ]
75106#![ warn( missing_docs) ]
@@ -89,28 +120,26 @@ pub use crate::init::{init, ClientInitGuard};
89120/// Available Sentry Integrations.
90121///
91122/// Integrations extend the functionality of the SDK for some common frameworks and
92- /// libraries. Integrations come two primary kinds: as event *sources* or as event
93- /// *processors*.
123+ /// libraries. There are two different kinds of integrations:
124+ /// - Event sources
125+ /// - Event processors
94126///
95- /// Integrations which are *sources*, like e.g. the
96- /// [`sentry::integrations::anyhow`](integrations::anyhow) integration, usually provide one
97- /// or more functions to create new events. They will usually provide their own extension
98- /// trait exposing a new method on the [`Hub`].
127+ /// Integrations which are **event sources** such as
128+ /// [`sentry::integrations::anyhow`] typically provide one or more functions to
129+ /// create new events. These integrations will have an extension trait which exposes
130+ /// a new method on the [`Hub`].
99131///
100- /// Integrations which *process* events in some way usually implement the
101- /// [`Itegration`](crate::Integration) trait and need to be installed when sentry is
102- /// initialised.
132+ /// Integrations which **process events** in some way usually implement the
133+ /// [`Integration`] trait and need to be installed when sentry is initialised.
103134///
104135/// # Installing Integrations
105136///
106- /// Processing integrations which implement [`Integration`](crate::Integration) need to be
107- /// installed when sentry is initialised. This is done using the
108- /// [`ClientOptions::add_integration`](crate::ClientOptions::add_integration) function, which you can
109- /// use to add extra integrations.
137+ /// Processing integrations which implement [`Integration`] need to be installed
138+ /// when sentry is initialised. This can be accomplished by using
139+ /// [`ClientOptions::add_integration()`].
110140///
111- /// For example if you disabled the default integrations (see below) but still wanted the
112- /// [`sentry::integrations::debug_images`](integrations::debug_images) integration enabled,
113- /// you could do this as such:
141+ /// For example, if one were to disable the default integrations (see below) but
142+ /// still wanted to use [`sentry::integrations::debug_images`]:
114143///
115144/// ```
116145/// # #[cfg(feature = "debug-images")] {
@@ -127,14 +156,19 @@ pub use crate::init::{init, ClientInitGuard};
127156///
128157/// # Default Integrations
129158///
130- /// The [`ClientOptions::default_integrations`](crate::ClientOptions::default_integrations)
131- /// option is a boolean field that when enabled will enable a number of default integrations
132- /// **before** any integrations provided by
133- /// [`ClientOptions::integrations`](crate::ClientOptions::integrations) are installed. This
134- /// is done using the [`apply_defaults`] function, which should be consulted for more
135- /// details and the list of which integrations are enabled by default .
159+ /// The [`ClientOptions::default_integrations`] option is a boolean field that
160+ /// when enabled will enable all of the default integrations via
161+ /// [`apply_defaults()`] **before** any integrations provided by
162+ /// [`ClientOptions::integrations`] are installed. Those interested in a list
163+ /// of default integrations and how they are applied are advised to visit
164+ /// [`apply_defaults()`]'s implementation .
136165///
137- /// [`apply_defaults`]: ../fn.apply_defaults.html
166+ /// [`sentry::integrations::anyhow`]: integrations::anyhow
167+ /// [`Integration`]: crate::Integration
168+ /// [`ClientOptions::add_integration()`]: crate::ClientOptions::add_integration
169+ /// [`sentry::integrations::debug_images`]: integrations::debug_images
170+ /// [`ClientOptions::default_integrations`]: crate::ClientOptions::default_integrations
171+ /// [`apply_defaults()`]: ../fn.apply_defaults.html
138172pub mod integrations {
139173 #[ cfg( feature = "anyhow" ) ]
140174 #[ doc( inline) ]
0 commit comments