bump sentry version

This commit is contained in:
tamo 2021-05-31 13:59:31 +02:00
parent 47a1bc34de
commit dffbaca63b
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
3 changed files with 167 additions and 519 deletions

634
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -78,17 +78,15 @@ pin-project = "1.0.7"
[dependencies.sentry] [dependencies.sentry]
default-features = false default-features = false
features = [ features = [
"with_client_implementation", "backtrace",
"with_panic", "contexts",
"with_failure", "panic",
"with_device_info", "reqwest",
"with_rust_info", "rustls",
"with_reqwest_transport", "log",
"with_rustls",
"with_env_logger"
] ]
optional = true optional = true
version = "0.18.1" version = "0.22.0"
[dev-dependencies] [dev-dependencies]

View File

@ -15,18 +15,8 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
async fn main() -> Result<(), MainError> { async fn main() -> Result<(), MainError> {
let opt = Opt::from_args(); let opt = Opt::from_args();
#[cfg(all(not(debug_assertions), feature = "sentry"))] let mut log_builder =
let _sentry = sentry::init(( env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"));
if !opt.no_sentry {
Some(opt.sentry_dsn.clone())
} else {
None
},
sentry::ClientOptions {
release: sentry::release_name!(),
..Default::default()
},
));
match opt.env.as_ref() { match opt.env.as_ref() {
"production" => { "production" => {
@ -36,16 +26,26 @@ async fn main() -> Result<(), MainError> {
.into(), .into(),
); );
} }
#[cfg(all(not(debug_assertions), feature = "sentry"))] #[cfg(all(not(debug_assertions), feature = "sentry"))]
if !opt.no_sentry && _sentry.is_enabled() { if !opt.no_sentry {
sentry::integrations::panic::register_panic_handler(); // TODO: This shouldn't be needed when upgrading to sentry 0.19.0. These integrations are turned on by default when using `sentry::init`. let logger = sentry::integrations::log::SentryLogger::with_dest(log_builder.build());
sentry::integrations::env_logger::init(None, Default::default()); log::set_boxed_logger(Box::new(logger))
.map(|()| log::set_max_level(log::LevelFilter::Info))
.unwrap();
let sentry = sentry::init(sentry::ClientOptions {
release: sentry::release_name!(),
dsn: Some(opt.sentry_dsn.parse()?),
..Default::default()
});
// sentry must stay alive as long as possible
std::mem::forget(sentry);
} else {
log_builder.init();
} }
} }
"development" => { "development" => {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")) log_builder.init();
.init();
} }
_ => unreachable!(), _ => unreachable!(),
} }