Struct actix_tools::sentry::sentry_client::Client [−][src]
pub struct Client { /* fields omitted */ }The Sentry client object.
Methods
impl Client[src]
impl Clientpub fn from_config<C>(cfg: C) -> Option<Client> where
C: IntoClient, [src]
pub fn from_config<C>(cfg: C) -> Option<Client> where
C: IntoClient, Creates a new Sentry client from a config helper.
As the config helper can also disable the client this method might return
None instead. This is what sentry::init uses internally before binding
the client.
The client config can be of one of many formats as implemented by the
IntoClient trait. The most common form is to just supply a
string with the DSN.
Supported Configs
The following common values are supported for the client config:
(): pick up the default config from the environment only&str/String/&OsStr/String: configure the client with the given DSNDsn/&Dsn: configure the client with a given DSN(C, options): configure the client from the given DSN and optional options.
The tuple form lets you do things like (Dsn, ClientOptions) for instance.
Panics
The IntoClient 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_dsn(dsn: Dsn) -> Client[src]
pub fn with_dsn(dsn: Dsn) -> ClientCreates a new sentry client for the given DSN.
pub fn with_dsn_and_options(dsn: Dsn, options: ClientOptions) -> Client[src]
pub fn with_dsn_and_options(dsn: Dsn, options: ClientOptions) -> ClientCreates a new sentry client for the given DSN.
pub fn disabled() -> Client[src]
pub fn disabled() -> ClientCreates a new client that does not send anything.
This is useful when general sentry handling is wanted but a client cannot be bound yet as the DSN might not be available yet. In that case a disabled client can be bound and later replaced by another one.
A disabled client can be detected by inspecting the DSN. If the DSN is None then
the client is disabled.
pub fn disabled_with_options(options: ClientOptions) -> Client[src]
pub fn disabled_with_options(options: ClientOptions) -> ClientCreates a new client that does not send anything with custom options.
pub fn options(&self) -> &ClientOptions[src]
pub fn options(&self) -> &ClientOptionsReturns the options of this client.
pub fn dsn(&self) -> Option<&Dsn>[src]
pub fn dsn(&self) -> Option<&Dsn>Returns the DSN that constructed this client.
If the client is in disabled mode this returns None.
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid[src]
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> UuidCaptures an event and sends it to sentry.
pub fn drain_events(&self, timeout: Option<Duration>) -> bool[src]
pub fn drain_events(&self, timeout: Option<Duration>) -> boolDrains all pending events up to the current time.
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 forever.
Trait Implementations
impl Clone for Client[src]
impl Clone for Clientfn clone(&self) -> Client[src]
fn clone(&self) -> ClientReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for Client[src]
impl Debug for Clientfn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl IntoClient for Client[src]
impl IntoClient for Clientfn into_client_config(self) -> (Option<Dsn>, Option<ClientOptions>)[src]
fn into_client_config(self) -> (Option<Dsn>, Option<ClientOptions>)Converts the object into a client config tuple of DSN and options. Read more
fn into_client(self) -> Option<Client>[src]
fn into_client(self) -> Option<Client>Converts the object into a client right away.