From e365c41cd6832ed14d86f11a3e09007503479b2c Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 4 Jan 2024 14:05:25 +0100 Subject: [PATCH] LOGGER: fixed debug colorization --- functions/logger.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 functions/logger.sh diff --git a/functions/logger.sh b/functions/logger.sh old mode 100644 new mode 100755 index 52effe18..eba2c81e --- a/functions/logger.sh +++ b/functions/logger.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # This script provides a logging function 'log' that can be sourced in other scripts. # It logs messages to both the terminal and a specified logfile, allowing different log levels. # The log function takes three parameters: log level, log message, and optionally the logfile. If no logfile is specified, it writes to retrodeck/logs/retrodeck.log @@ -30,9 +32,9 @@ log() { echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile") ;; d) - # Debug (green) for both terminal and log file + # Debug (green) for both terminal, no color for log file colored_message="\e[32m[DEBUG]\e[0m $message" - echo "$timestamp $colored_message" | tee -a "$logfile" + echo "$timestamp $colored_message" | tee -a >(sed $'s,\e\\[[0-9;]*[a-zA-Z],,g' >> "$logfile") ;; *) # Default (no color)