diff --git a/Cargo.toml b/Cargo.toml index fc9c670..a76bd50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ gtk = "0.15.5" gtk-layer-shell = "0.4.1" glib = "0.15.12" tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread", "time"] } -tracing = "0.1.36" -tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } +tracing = "0.1.37" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } tracing-error = "0.2.0" tracing-appender = "0.2.2" strip-ansi-escapes = "0.1.1" diff --git a/src/main.rs b/src/main.rs index 8997859..8e35a95 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,14 +19,14 @@ use dirs::config_dir; use gtk::gdk::Display; use gtk::prelude::*; use gtk::Application; -use std::env; +use std::{env, panic}; use std::future::Future; use std::process::exit; use tokio::runtime::Handle; use tokio::task::block_in_place; use crate::logging::install_tracing; -use tracing::{debug, error, info}; +use tracing::{debug, error, info, warn}; use wayland::WaylandClient; const VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -49,7 +49,15 @@ async fn main() -> Result<()> { // otherwise file logging drops let _guard = install_tracing()?; - color_eyre::install()?; + let hook_builder = color_eyre::config::HookBuilder::default(); + let (panic_hook, eyre_hook) = hook_builder.into_hooks(); + + eyre_hook.install()?; + + // custom hook allows tracing_appender to capture panics + panic::set_hook(Box::new(move |panic_info| { + error!("{}", panic_hook.panic_report(panic_info)) + })); info!("Ironbar version {}", VERSION); info!("Starting application");