Add logging function with improved output formatting

- Introduced a log() function to capture console output to a file
- Added date separator and blank lines for better readability
- Stripped ANSI color codes to avoid strange characters in the log
This commit is contained in:
2025-01-04 19:47:31 +09:00
parent 6642d5a265
commit 501d29cad7
3 changed files with 19 additions and 5 deletions
+4
View File
@@ -1,5 +1,9 @@
#!/bin/bash
LOG_FILE="kazewp.log"
exec > >(tee -a "$LOG_FILE") 2>&1
echo -e "\n========== $(date '+%Y-%m-%d %H:%M:%S') =========="
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"