From e08bf2f69af2d155f3c575fb6810e35872850b99 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sun, 16 May 2021 16:26:03 +0200 Subject: [PATCH] feat(core): add logging for panics --- Cargo.lock | 10 ++++++++++ espanso/Cargo.toml | 3 ++- espanso/src/main.rs | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 4b711da..eda3076 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,6 +314,7 @@ dependencies = [ "html2text", "lazy_static", "log", + "log-panics", "maplit", "markdown", "serde", @@ -627,6 +628,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "log-panics" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef" +dependencies = [ + "log", +] + [[package]] name = "mac" version = "0.1.1" diff --git a/espanso/Cargo.toml b/espanso/Cargo.toml index 0134cb0..9c0762c 100644 --- a/espanso/Cargo.toml +++ b/espanso/Cargo.toml @@ -36,4 +36,5 @@ dirs = "3.0.1" serde = { version = "1.0.123", features = ["derive"] } serde_json = "1.0.62" markdown = "0.3.0" -html2text = "0.2.1" \ No newline at end of file +html2text = "0.2.1" +log-panics = "2.0.0" \ No newline at end of file diff --git a/espanso/src/main.rs b/espanso/src/main.rs index c210732..d09c168 100644 --- a/espanso/src/main.rs +++ b/espanso/src/main.rs @@ -263,6 +263,9 @@ fn main() { WriteLogger::new(LevelFilter::Info, config, log_proxy.clone()), ]) .expect("unable to initialize logs"); + + // Activate logging for panics + log_panics::init(); } let mut cli_args: CliModuleArgs = CliModuleArgs::default();