Coloured Logging
Using the below function
sh
log() {
local RED="\e[31m"
local GREEN="\e[32m"
local YELLOW="\e[33m"
local ENDCOLOR="\e[0m"
if [ "$1" == "err" ]; then
echo -e "${RED}${2}${ENDCOLOR}"
elif [ "$1" == "warn" ]; then
echo -e "${YELLOW}${2}${ENDCOLOR}"
elif [ "$1" == "info" ]; then
echo -e "${GREEN}${2}${ENDCOLOR}"
else
echo -e "${RED}Must use either `log err`, `log warn`, or `log info`${ENDCOLOR}"
fi
}
log() {
local RED="\e[31m"
local GREEN="\e[32m"
local YELLOW="\e[33m"
local ENDCOLOR="\e[0m"
if [ "$1" == "err" ]; then
echo -e "${RED}${2}${ENDCOLOR}"
elif [ "$1" == "warn" ]; then
echo -e "${YELLOW}${2}${ENDCOLOR}"
elif [ "$1" == "info" ]; then
echo -e "${GREEN}${2}${ENDCOLOR}"
else
echo -e "${RED}Must use either `log err`, `log warn`, or `log info`${ENDCOLOR}"
fi
}