From 50a788ab5c3539f0f7cbcdeae5492a2df4193fe1 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 21 May 2023 18:27:33 +0200 Subject: [PATCH] fix logger --- script | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/script b/script index c17e88f..0a020ad 100755 --- a/script +++ b/script @@ -46,6 +46,7 @@ main() { } log() { + LOG_VERBOSE="${LOG_VERBOSE:-info}" LEVEL=info TIME= @@ -59,15 +60,21 @@ log() { if [ -t 2 ] && [ -z "${NO_COLOR-}" ]; then case "${LEVEL}" in - debug) COLOR="$(tput setaf 3)"; LEVEL=100;; - notice) COLOR="$(tput setaf 4)"; LEVEL=250;; - warning) COLOR="$(tput setaf 5)"; LEVEL=300;; - error) COLOR="$(tput setaf 1)"; LEVEL=400;; - *) COLOR="$(tput sgr0)"; LEVEL=200;; + debug) COLOR="$(tput setaf 3)";; + notice) COLOR="$(tput setaf 4)";; + warning) COLOR="$(tput setaf 5)";; + error) COLOR="$(tput setaf 1)";; + *) COLOR="$(tput sgr0)";; esac fi - LOG_VERBOSE="${LOG_VERBOSE:-info}" + case "${LEVEL}" in + debug) LEVEL=100;; + notice) LEVEL=250;; + warning) LEVEL=300;; + error) LEVEL=400;; + *) LEVEL=200;; + esac case "${LOG_VERBOSE}" in debug) LOG_VERBOSE_VALUE=100;;