From 44dd8d74641736110d37d8f69f753feb362f2ed1 Mon Sep 17 00:00:00 2001 From: Davide Date: Fri, 3 Jan 2025 01:51:12 +0100 Subject: [PATCH] only log instance launches --- .../src/managers/instance/run/mod.rs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/carbon_app/src/managers/instance/run/mod.rs b/crates/carbon_app/src/managers/instance/run/mod.rs index 123158e2c..1d212ab2f 100644 --- a/crates/carbon_app/src/managers/instance/run/mod.rs +++ b/crates/carbon_app/src/managers/instance/run/mod.rs @@ -257,24 +257,32 @@ impl ManagerRef<'_, InstanceManager> { let log_file_name = format!("{}_{}", now.format("%Y-%m-%d"), now.format("%H-%M-%S")); - let logs_file_path = instance_path - .get_gdl_logs_path() - .join(format!("{}.log", log_file_name)); + let logs_file_path = if launch_account.is_some() { + Some( + instance_path + .get_gdl_logs_path() + .join(format!("{}.log", log_file_name)), + ) + } else { + None + }; let logs_file_path_clone = logs_file_path.clone(); + let logs_file_path_clone_1 = logs_file_path.clone(); let file_fut = logs_file_path - .parent() + .and_then(|p| p.parent().map(|p| p.to_owned())) .map(|p| async { if let Err(e) = - tokio::fs::create_dir_all(&logs_file_path_clone.parent().unwrap()).await + tokio::fs::create_dir_all(&logs_file_path_clone.unwrap().parent().unwrap()) + .await { tracing::error!({ error = ?e }, "Failed to create log directory"); } }) .map(|f| async { f.await; - tokio::fs::File::create(&logs_file_path_clone).await + tokio::fs::File::create(&logs_file_path_clone_1.unwrap()).await }); let mut file = match file_fut {