From 5f192d0e778635ff3fc59975d1efe6a9fbcf3429 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 9 Jul 2024 10:55:58 +0200 Subject: [PATCH] consistent extension for `.log` files should help in reading them. This might particularly be true on Windows. Note that we don't call them `txt` to make opening them with a specialized program easier. --- crates/gitbutler-tauri/src/logs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/gitbutler-tauri/src/logs.rs b/crates/gitbutler-tauri/src/logs.rs index 620a4ca65..dac67b9fe 100644 --- a/crates/gitbutler-tauri/src/logs.rs +++ b/crates/gitbutler-tauri/src/logs.rs @@ -12,18 +12,20 @@ pub fn init(app_handle: &AppHandle) { .expect("failed to get logs dir"); fs::create_dir_all(&logs_dir).expect("failed to create logs dir"); - let log_prefix = "GitButler.log"; + let log_prefix = "GitButler"; + let log_suffix = "log"; let max_log_files = 14; let file_appender = RollingFileAppender::builder() .rotation(Rotation::DAILY) .max_log_files(max_log_files) .filename_prefix(log_prefix) + .filename_suffix(log_suffix) .build(&logs_dir) .expect("initializing rolling file appender failed"); let (file_writer, guard) = tracing_appender::non_blocking(file_appender); // As the file-writer only checks `max_log_files` on file rotation, it bascially never happens. // Run it now. - prune_old_logs(&logs_dir, Some(log_prefix), None, max_log_files).ok(); + prune_old_logs(&logs_dir, Some(log_prefix), Some(log_suffix), max_log_files).ok(); app_handle.manage(guard); // keep the guard alive for the lifetime of the app