r3549@krups: intrigeri | 2005-11-14 21:47:01 +0100
[matthijs/upstream/backupninja.git] / src / backupninja.in
index 55a3d00410371ff452ebabb31ba661aef7595915..31b8d1b10545c3147bafbf74f66f8de545fd0b3f 100755 (executable)
@@ -19,7 +19,7 @@
 #####################################################
 ## FUNCTIONS
 
-function setupcolors() {
+setupcolors () {
        BLUE="\033[34;01m"
        GREEN="\033[32;01m"
        YELLOW="\033[33;01m"
@@ -27,20 +27,18 @@ function setupcolors() {
        RED="\033[31;01m"
        OFF="\033[0m"
        CYAN="\033[36;01m"
-       COLORS=($BLUE $GREEN $YELLOW $RED $PURPLE)
 }
 
-function colorize() {
+colorize () {
        if [ "$usecolors" == "yes" ]; then
                local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
-               [ "$typestr" == "Debug" ] && type=0
-               [ "$typestr" == "Info" ] && type=1
-               [ "$typestr" == "Warning" ] && type=2
-               [ "$typestr" == "Error" ] && type=3
-               [ "$typestr" == "Fatal" ] && type=4
-               color=${COLORS[$type]}
+               [ "$typestr" == "Debug" ] && COLOR=$BLUE
+               [ "$typestr" == "Info" ] && COLOR=$GREEN
+               [ "$typestr" == "Warning" ] && COLOR=$YELLOW
+               [ "$typestr" == "Error" ] && COLOR=$RED
+               [ "$typestr" == "Fatal" ] && COLOR=$PURPLE
                endcolor=$OFF
-               echo -e "$color$@$endcolor"
+               echo -e "$COLOR$@$endcolor"
        else
                echo -e "$@"
        fi
@@ -50,8 +48,8 @@ function colorize() {
 # 0 - debug - blue
 # 1 - normal messages - green
 # 2 - warnings - yellow
-# 3 - errors - orange
-# 4 - fatal - red
+# 3 - errors - red
+# 4 - fatal - purple
 # First variable passed is the error level, all others are printed
 
 # if 1, echo out all warnings, errors, or fatal