mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +02:00
fix(logging): file log not capturing panics
This commit is contained in:
parent
3c43c20c6a
commit
70e1b526a9
2 changed files with 13 additions and 5 deletions
|
@ -13,8 +13,8 @@ gtk = "0.15.5"
|
||||||
gtk-layer-shell = "0.4.1"
|
gtk-layer-shell = "0.4.1"
|
||||||
glib = "0.15.12"
|
glib = "0.15.12"
|
||||||
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread", "time"] }
|
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread", "time"] }
|
||||||
tracing = "0.1.36"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
||||||
tracing-error = "0.2.0"
|
tracing-error = "0.2.0"
|
||||||
tracing-appender = "0.2.2"
|
tracing-appender = "0.2.2"
|
||||||
strip-ansi-escapes = "0.1.1"
|
strip-ansi-escapes = "0.1.1"
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -19,14 +19,14 @@ use dirs::config_dir;
|
||||||
use gtk::gdk::Display;
|
use gtk::gdk::Display;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::Application;
|
use gtk::Application;
|
||||||
use std::env;
|
use std::{env, panic};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tokio::task::block_in_place;
|
use tokio::task::block_in_place;
|
||||||
|
|
||||||
use crate::logging::install_tracing;
|
use crate::logging::install_tracing;
|
||||||
use tracing::{debug, error, info};
|
use tracing::{debug, error, info, warn};
|
||||||
use wayland::WaylandClient;
|
use wayland::WaylandClient;
|
||||||
|
|
||||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
@ -49,7 +49,15 @@ async fn main() -> Result<()> {
|
||||||
// otherwise file logging drops
|
// otherwise file logging drops
|
||||||
let _guard = install_tracing()?;
|
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!("Ironbar version {}", VERSION);
|
||||||
info!("Starting application");
|
info!("Starting application");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue