fix: only print colored timestamp and message when stdout is a terminal

This commit is contained in:
Andrey Petelin
2026-01-23 15:59:26 +05:00
parent 8e18426a53
commit 12d8537d90

View File

@@ -18,7 +18,9 @@ nolog() {
local timestamp local timestamp
timestamp=$(date +"%Y-%m-%d %H:%M:%S") timestamp=$(date +"%Y-%m-%d %H:%M:%S")
if [ -t 1 ]; then
echo -e "${COLOR_CYAN}[$timestamp]${COLOR_RESET} ${COLOR_GREEN}$message${COLOR_RESET}" echo -e "${COLOR_CYAN}[$timestamp]${COLOR_RESET} ${COLOR_GREEN}$message${COLOR_RESET}"
fi
} }
echolog() { echolog() {