[−][src]Struct sentry_core::Client
The Sentry Client.
The Client is responsible for event processing and sending events to the
sentry server via the configured Transport
. It can be created from a
ClientOptions
.
See the Unified API document for more details.
Examples
sentry::Client::from(sentry::ClientOptions::default());
Implementations
impl Client
[src]
pub fn from_config<O: Into<ClientOptions>>(opts: O) -> Client
[src]
Creates a new Sentry client from a config.
Supported Configs
The following common values are supported for the client config:
ClientOptions
: configure the client with the given client options.()
or empty string: Disable the client.&str
/String
/&OsStr
/String
: configure the client with the given DSN.Dsn
/&Dsn
: configure the client with a given DSN.(Dsn, ClientOptions)
: configure the client from the given DSN and optional options.
The Default
implementation of ClientOptions
pulls in the DSN from the
SENTRY_DSN
environment variable.
Panics
The Into<ClientOptions>
implementations can panic for the forms where a DSN needs to be
parsed. If you want to handle invalid DSNs you need to parse them manually by calling
parse on it and handle the error.
pub fn with_options(options: ClientOptions) -> Client
[src]
Creates a new sentry client for the given options.
If the DSN on the options is set to None
the client will be entirely
disabled.
pub fn options(&self) -> &ClientOptions
[src]
Returns the options of this client.
pub fn dsn(&self) -> Option<&Dsn>
[src]
Returns the DSN that constructed this client.
pub fn is_enabled(&self) -> bool
[src]
Quick check to see if the client is enabled.
The Client is enabled if it has a valid DSN and Transport configured.
Examples
use std::sync::Arc; let client = sentry::Client::from(sentry::ClientOptions::default()); assert!(!client.is_enabled()); let dsn = "https://public@example.com/1"; let transport = sentry::test::TestTransport::new(); let client = sentry::Client::from(( dsn, sentry::ClientOptions { transport: Some(Arc::new(transport)), ..Default::default() }, )); assert!(client.is_enabled());
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
[src]
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
Captures an event and sends it to sentry.
pub fn close(&self, timeout: Option<Duration>) -> bool
[src]
Drains all pending events and shuts down the transport behind the client. After shutting down the transport is removed.
This returns true
if the queue was successfully drained in the
given time or false
if not (for instance because of a timeout).
If no timeout is provided the client will wait for as long a
shutdown_timeout
in the client options.
Trait Implementations
impl Clone for Client
[src]
impl Debug for Client
[src]
impl<T: Into<ClientOptions>> From<T> for Client
[src]
impl RefUnwindSafe for Client
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,