refactor: separate log output to stdout and file, gracefully handling file write failures.
This commit is contained in:
@@ -45,7 +45,9 @@ RETRY_DELAY="${RETRY_DELAY:-5}"
|
||||
log() {
|
||||
local timestamp
|
||||
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo "[$timestamp] $*" | tee -a "$LOG_FILE" 2>/dev/null || echo "[$timestamp] $*"
|
||||
local msg="[$timestamp] $*"
|
||||
echo "$msg"
|
||||
echo "$msg" >> "$LOG_FILE" 2>/dev/null || true
|
||||
}
|
||||
|
||||
log_error() {
|
||||
|
||||
Reference in New Issue
Block a user