cisco-vpn: Strip ANSI color codes from log file
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
This commit is contained in:
@@ -70,8 +70,11 @@ log() {
|
|||||||
local timestamp_short=$(date '+%H:%M:%S')
|
local timestamp_short=$(date '+%H:%M:%S')
|
||||||
local log_file=$(get_log_file)
|
local log_file=$(get_log_file)
|
||||||
|
|
||||||
|
# Strip ANSI color codes for log file
|
||||||
|
local msg_plain=$(echo -e "$msg" | sed 's/\x1b\[[0-9;]*m//g')
|
||||||
|
|
||||||
# Write to log file (plain text, no colors)
|
# Write to log file (plain text, no colors)
|
||||||
echo "[$timestamp] [$level] $msg" >> "$log_file"
|
echo "[$timestamp] [$level] $msg_plain" >> "$log_file"
|
||||||
|
|
||||||
# Write to console (with colors)
|
# Write to console (with colors)
|
||||||
case $level in
|
case $level in
|
||||||
|
|||||||
Reference in New Issue
Block a user