From: Michael Tremer Date: Sat, 30 Jun 2012 09:53:21 +0000 (+0000) Subject: logging: Fix output on different consoles. X-Git-Tag: 005~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2002f468ca07eadb57b9743dcde36bd43e1d441;p=network.git logging: Fix output on different consoles. --- 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 }