Skip to content

Commit 996e06a

Browse files
committed
Log panic to log file
1 parent e11231a commit 996e06a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/telemetry.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use log::error;
12
use reqwest::blocking::Client;
23
use serde::Serialize;
34
use std::panic::{self, AssertUnwindSafe};
@@ -193,6 +194,9 @@ pub fn send_log(level: LogLevel, message: &str) {
193194
/// Installs a panic hook that logs panics and sends crash reports
194195
pub fn install_panic_hook() {
195196
panic::set_hook(Box::new(|panic_info| {
197+
// Log the panic to both stderr and log file
198+
error!("Application panicked: {:?}", panic_info);
199+
196200
// Filter out secondary "panic in a function that cannot unwind" panics
197201
if let Some(location) = panic_info.location() {
198202
if location.file().contains("panicking.rs") {

0 commit comments

Comments
 (0)