From 7ef8bd6377fe49e75240083d80437afee30e118c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 9 Oct 2023 09:21:08 -0700 Subject: [PATCH] Always log panics (#2896) I just panicked and wanted to see the cause, but forgot that panic files get deleted when Zed uploads them. Release Notes: - Panics are now written to `~/Library/Logs/Zed/Zed.log` --- crates/zed/src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 12ae0f2ffce9709b5b9c45cb2b28053c5bf1f355..cd862f031f055513f60fe7f980a8d371da3e0f96 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -495,11 +495,11 @@ fn init_panic_hook(app: &App, installation_id: Option, session_id: Strin session_id: session_id.clone(), }; - if is_pty { - if let Some(panic_data_json) = serde_json::to_string_pretty(&panic_data).log_err() { - eprintln!("{}", panic_data_json); - } - } else { + if let Some(panic_data_json) = serde_json::to_string_pretty(&panic_data).log_err() { + log::error!("{}", panic_data_json); + } + + if !is_pty { if let Some(panic_data_json) = serde_json::to_string(&panic_data).log_err() { let timestamp = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string(); let panic_file_path = paths::LOGS_DIR.join(format!("zed-{}.panic", timestamp));