Integrate Sentry for crash logging.
This commit is contained in:
parent
68e5143386
commit
fae8b559cf
|
@ -33,4 +33,5 @@ mapgen = "0.5"
|
|||
maze_generator = "1"
|
||||
pathfinding = "2"
|
||||
rand = "0.8"
|
||||
sentry = "0.23"
|
||||
shadowcast = "0.8"
|
||||
|
|
13
src/error.rs
13
src/error.rs
|
@ -44,10 +44,21 @@ fn init_panic_handler() {
|
|||
}));
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ErrorConfig {
|
||||
pub sentry_dsn: Option<String>,
|
||||
}
|
||||
|
||||
pub struct ErrorPlugin;
|
||||
|
||||
impl Plugin for ErrorPlugin {
|
||||
fn build(&self, _: &mut AppBuilder) {
|
||||
fn build(&self, app: &mut AppBuilder) {
|
||||
init_panic_handler();
|
||||
if let Some(config) = app.world().get_resource::<ErrorConfig>() {
|
||||
if let Some(dsn) = &config.sentry_dsn {
|
||||
let guard = sentry::init(dsn.clone());
|
||||
app.insert_resource(guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user