git-svn-id: http://code.autistici.org/svn/backupninja/trunk@255
758a04ac-41e6-0310-8a23-
8373a73cc35d
#####################################################
## FUNCTIONS
#####################################################
## FUNCTIONS
+function setupcolors () {
BLUE="\033[34;01m"
GREEN="\033[32;01m"
YELLOW="\033[33;01m"
BLUE="\033[34;01m"
GREEN="\033[32;01m"
YELLOW="\033[33;01m"
RED="\033[31;01m"
OFF="\033[0m"
CYAN="\033[36;01m"
RED="\033[31;01m"
OFF="\033[0m"
CYAN="\033[36;01m"
+ COLORS=($BLUE $GREEN $YELLOW $RED $PURPLE)
if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
- [ "$typestr" == "Debug" ] && COLOR=$BLUE
- [ "$typestr" == "Info" ] && COLOR=$GREEN
- [ "$typestr" == "Warning" ] && COLOR=$YELLOW
- [ "$typestr" == "Error" ] && COLOR=$RED
- [ "$typestr" == "Fatal" ] && COLOR=$PURPLE
+ [ "$typestr" == "Debug" ] && type=0
+ [ "$typestr" == "Info" ] && type=1
+ [ "$typestr" == "Warning" ] && type=2
+ [ "$typestr" == "Error" ] && type=3
+ [ "$typestr" == "Fatal" ] && type=4
+ color=${COLORS[$type]}
- echo -e "$COLOR$@$endcolor"
+ echo -e "$color$@$endcolor"