Function sentry::init [] [src]

pub fn init<C: IntoClientConfig>(cfg: C) -> ClientInitGuard

Creates the Sentry client for a given client config and binds it.

This returns a client init guard that if kept in scope will help the client send events before the application closes by calling drain on the generated client. If the scope guard is immediately dropped then no draining will take place so ensure it's bound to a variable.

Examples

fn main() {
    let _sentry = sentry::init("https://key@sentry.io/1234");
}

This behaves similar to creating a client by calling Client::from_config but gives a simplified interface that transparently handles clients not being created by the Dsn being empty.