From 40521b44e0982542bc30ab9bc3684c0bc3b7d09f Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 26 Dec 2025 11:27:30 +0800 Subject: [PATCH] refactor: simplify log file initialization by consolidating directory and file creation. --- lib/core/log.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/core/log.sh b/lib/core/log.sh index 20ead40..001a24a 100644 --- a/lib/core/log.sh +++ b/lib/core/log.sh @@ -25,11 +25,8 @@ readonly LOG_FILE="${HOME}/.config/mole/mole.log" readonly DEBUG_LOG_FILE="${HOME}/.config/mole/mole_debug_session.log" readonly LOG_MAX_SIZE_DEFAULT=1048576 # 1MB -# Ensure log directory exists -ensure_user_dir "$(dirname "$LOG_FILE")" -if is_root_user && [[ -n "${SUDO_USER:-}" && "${SUDO_USER:-}" != "root" ]]; then - ensure_user_file "$LOG_FILE" -fi +# Ensure log directory and file exist with correct ownership +ensure_user_file "$LOG_FILE" # ============================================================================ # Log Rotation