fix: redirect low-level logging functions to STDERR
This commit is contained in:
+2
-2
@@ -32,7 +32,7 @@ log() {
|
|||||||
|
|
||||||
local ts
|
local ts
|
||||||
ts=$(date '+%H:%M:%S')
|
ts=$(date '+%H:%M:%S')
|
||||||
echo -e "${color}[${label}]${NC} ${msg}"
|
echo -e "${color}[${label}]${NC} ${msg}" >&2
|
||||||
|
|
||||||
if [ -n "$LOG_FILE" ]; then
|
if [ -n "$LOG_FILE" ]; then
|
||||||
echo "[${ts}] [${label}] ${msg}" >> "$LOG_FILE" 2>/dev/null || true
|
echo "[${ts}] [${label}] ${msg}" >> "$LOG_FILE" 2>/dev/null || true
|
||||||
@@ -40,7 +40,7 @@ log() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_exit() {
|
error_exit() {
|
||||||
log "ERROR" "$1" >&2
|
log "ERROR" "$1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ log() {
|
|||||||
|
|
||||||
local ts
|
local ts
|
||||||
ts=$(date '+%H:%M:%S')
|
ts=$(date '+%H:%M:%S')
|
||||||
echo -e "${color}[${label}]${NC} ${msg}"
|
echo -e "${color}[${label}]${NC} ${msg}" >&2
|
||||||
|
|
||||||
if [ -n "$LOG_FILE" ]; then
|
if [ -n "$LOG_FILE" ]; then
|
||||||
echo "[${ts}] [${label}] ${msg}" >> "$LOG_FILE" 2>/dev/null || true
|
echo "[${ts}] [${label}] ${msg}" >> "$LOG_FILE" 2>/dev/null || true
|
||||||
@@ -43,7 +43,7 @@ log() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_exit() {
|
error_exit() {
|
||||||
log "ERROR" "$1" >&2
|
log "ERROR" "$1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user