LCOV - code coverage report
Current view: top level - libs/utils/src - sentry_init.rs (source / functions) Coverage Total Hit
Test: b4ae4c4857f9ef3e144e982a35ee23bc84c71983.info Lines: 0.0 % 22 0
Test Date: 2024-10-22 22:13:45 Functions: 0.0 % 3 0

            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            0 : pub fn init_sentry(
       9            0 :     release_name: Option<Cow<'static, str>>,
      10            0 :     extra_options: &[(&str, &str)],
      11            0 : ) -> Option<ClientInitGuard> {
      12            0 :     let dsn = env::var("SENTRY_DSN").ok()?;
      13            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            0 : }
        

Generated by: LCOV version 2.1-beta