Struct ClientInitGuard
pub struct ClientInitGuard(/* private fields */);Expand description
Helper struct that is returned from init.
When this is dropped events are drained with the configured shutdown_timeout.
Implementations§
§impl ClientInitGuard
impl ClientInitGuard
pub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Quick check if the client is enabled.
Methods from Deref<Target = Client>§
pub fn prepare_event(
&self,
event: Event<'static>,
scope: Option<&Scope>,
) -> Option<Event<'static>>
pub fn prepare_event( &self, event: Event<'static>, scope: Option<&Scope>, ) -> Option<Event<'static>>
Prepares an event for transmission to sentry.
pub fn options(&self) -> &ClientOptions
pub fn options(&self) -> &ClientOptions
Returns the options of this client.
pub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
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
pub fn capture_event( &self, event: Event<'static>, scope: Option<&Scope>, ) -> Uuid
Captures an event and sends it to sentry.
pub fn send_envelope(&self, envelope: Envelope)
pub fn send_envelope(&self, envelope: Envelope)
Sends the specified Envelope to sentry.
pub fn flush(&self, timeout: Option<Duration>) -> bool
pub fn flush(&self, timeout: Option<Duration>) -> bool
Drains all pending events without shutting down.
pub fn close(&self, timeout: Option<Duration>) -> bool
pub fn close(&self, timeout: Option<Duration>) -> bool
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.
pub fn sample_should_send(&self, rate: f32) -> bool
pub fn sample_should_send(&self, rate: f32) -> bool
Returns a random boolean with a probability defined by rate
pub fn capture_log(&self, log: Log, scope: &Scope)
pub fn capture_log(&self, log: Log, scope: &Scope)
Captures a log and sends it to Sentry.