From e7a260da3782d781ba3f5890af494c6f37f664d0 Mon Sep 17 00:00:00 2001 From: Chris Dascalos Date: Mon, 23 Aug 2021 19:26:51 -0500 Subject: [PATCH] Updates: * Minor update to improve logging capabilities (https://github.com/koalaman/shellcheck/wiki/SC2059). --- slog.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slog.sh b/slog.sh index 4bbf267..2763b5d 100644 --- a/slog.sh +++ b/slog.sh @@ -98,14 +98,14 @@ log() { eval log_level_stdout="\$LOG_LEVEL_${LOG_LEVEL_STDOUT}" if [ $log_level_stdout -le $log_level_int ]; then # STDOUT - printf "${log_color}[$(date +"%Y-%m-%d %H:%M:%S %Z")] [${log_level}] ${log_text} ${LOG_DEFAULT_COLOR}\n"; + printf "%s\n" "${log_color}[$(date +"%Y-%m-%d %H:%M:%S %Z")] [${log_level}] ${log_text} ${LOG_DEFAULT_COLOR}"; fi eval log_level_log="\$LOG_LEVEL_${LOG_LEVEL_LOG}" # Check LOG_LEVEL_LOG to see if this level of entry goes to LOG_PATH if [ $log_level_log -le $log_level_int ]; then # LOG_PATH minus fancypants colors if [ ! -z $LOG_PATH ]; then - printf "[$(date +"%Y-%m-%d %H:%M:%S %Z")] [${log_level}] ${log_text}\n" >> $LOG_PATH; + printf "%s\n" "[$(date +"%Y-%m-%d %H:%M:%S %Z")] [${log_level}] ${log_text}" >> $LOG_PATH; fi fi