LCOV - differential code coverage report
Current view: top level - libs/utils/src - sentry_init.rs (source / functions) Coverage Total Hit UBC CBC
Current: f6946e90941b557c917ac98cd5a7e9506d180f3e.info Lines: 27.3 % 22 6 16 6
Current Date: 2023-10-19 02:04:12 Functions: 33.3 % 3 1 2 1
Baseline: c8637f37369098875162f194f92736355783b050.info
Baseline Date: 2023-10-18 20:25:20

           TLA  Line data    Source code
       1                 : use sentry::ClientInitGuard;
       2                 : use std::borrow::Cow;
       3                 : use std::env;
       4                 : 
       5                 : pub use sentry::release_name;
       6                 : 
       7                 : #[must_use]
       8 CBC        1429 : pub fn init_sentry(
       9            1429 :     release_name: Option<Cow<'static, str>>,
      10            1429 :     extra_options: &[(&str, &str)],
      11            1429 : ) -> Option<ClientInitGuard> {
      12            1429 :     let dsn = env::var("SENTRY_DSN").ok()?;
      13 UBC           0 :     let environment = env::var("SENTRY_ENVIRONMENT").unwrap_or_else(|_| "development".into());
      14               0 : 
      15               0 :     let guard = sentry::init((
      16               0 :         dsn,
      17               0 :         sentry::ClientOptions {
      18               0 :             release: release_name,
      19               0 :             environment: Some(environment.into()),
      20               0 :             ..Default::default()
      21               0 :         },
      22               0 :     ));
      23               0 :     sentry::configure_scope(|scope| {
      24               0 :         for &(key, value) in extra_options {
      25               0 :             scope.set_extra(key, value.into());
      26               0 :         }
      27               0 :     });
      28               0 :     Some(guard)
      29 CBC        1429 : }
        

Generated by: LCOV version 2.1-beta