mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 13:31:12 +00:00
refactor: simplify log file initialization by consolidating directory and file creation.
This commit is contained in:
@@ -25,11 +25,8 @@ readonly LOG_FILE="${HOME}/.config/mole/mole.log"
|
|||||||
readonly DEBUG_LOG_FILE="${HOME}/.config/mole/mole_debug_session.log"
|
readonly DEBUG_LOG_FILE="${HOME}/.config/mole/mole_debug_session.log"
|
||||||
readonly LOG_MAX_SIZE_DEFAULT=1048576 # 1MB
|
readonly LOG_MAX_SIZE_DEFAULT=1048576 # 1MB
|
||||||
|
|
||||||
# Ensure log directory exists
|
# Ensure log directory and file exist with correct ownership
|
||||||
ensure_user_dir "$(dirname "$LOG_FILE")"
|
ensure_user_file "$LOG_FILE"
|
||||||
if is_root_user && [[ -n "${SUDO_USER:-}" && "${SUDO_USER:-}" != "root" ]]; then
|
|
||||||
ensure_user_file "$LOG_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Log Rotation
|
# Log Rotation
|
||||||
|
|||||||
Reference in New Issue
Block a user