From c2002f468ca07eadb57b9743dcde36bd43e1d441 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 30 Jun 2012 09:53:21 +0000 Subject: [PATCH] logging: Fix output on different consoles. --- functions.logging | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/functions.logging b/functions.logging index 7357a60c..9df5ce86 100644 --- a/functions.logging +++ b/functions.logging @@ -49,14 +49,14 @@ function log() { [ "${LOG_DISABLE_STDOUT}" = "true" ] && return 0 local colour - local console=">&2" + local console="2" case "${level}" in DEBUG) colour="${CLR_CYAN_R}" ;; INFO) colour="${CLR_BLACK_R}" - console="" + console="1" ;; WARNING) colour="${CLR_YELLOW_R}" @@ -66,5 +66,12 @@ function log() { ;; esac - printf "${colour}${message}${CLR_RESET_ALL}\n" ${console} + case "${console}" in + 1) + printf "${colour}${message}${CLR_RESET_ALL}\n" + ;; + 2) + printf "${colour}${message}${CLR_RESET_ALL}\n" >&2 + ;; + esac } -- 2.47.3