Restore temp file initialization in telemetry code (#4043)

Release Notes:

- Fix 'open telemetry log' command to actually show the telemetry log.
This commit is contained in:
Mikayla Maki
2024-01-13 09:04:08 -08:00
committed by GitHub
+16
View File
@@ -14,6 +14,8 @@ use sysinfo::{
};
use tempfile::NamedTempFile;
use util::http::HttpClient;
#[cfg(not(debug_assertions))]
use util::ResultExt;
use util::{channel::ReleaseChannel, TryFutureExt};
use self::event_coalescer::EventCoalescer;
@@ -167,6 +169,20 @@ impl Telemetry {
event_coalescer: EventCoalescer::new(),
}));
#[cfg(not(debug_assertions))]
cx.background_executor()
.spawn({
let state = state.clone();
async move {
if let Some(tempfile) =
NamedTempFile::new_in(util::paths::CONFIG_DIR.as_path()).log_err()
{
state.lock().log_file = Some(tempfile);
}
}
})
.detach();
cx.observe_global::<SettingsStore>({
let state = state.clone();