Activate colored output
This commit is contained in:
parent
87be571e43
commit
9dd7eb7a3c
16
log_helpers
16
log_helpers
@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
# set -x
|
||||
|
||||
RED='\e[0;31m'
|
||||
GREEN='\e[0;32m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
|
||||
readonly log_helpers_sourced=${BASH_SOURCE[0]}
|
||||
|
||||
@ -47,32 +51,32 @@ if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
|
||||
|
||||
log_info() {
|
||||
if [ $log_level -le $INFO ]; then
|
||||
log "INFO $*"
|
||||
log "${GREEN}INFO $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
if [ $log_level -le $WARN ]; then
|
||||
log "WARN $*"
|
||||
log "${RED}WARN $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_crit() {
|
||||
if [ $log_level -le $CRIT ]; then
|
||||
log "CRIT $*"
|
||||
log "${RED}CRIT $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_error() {
|
||||
if [ $log_level -le $ERROR ]; then
|
||||
log "ERROR $*"
|
||||
log "${RED}ERROR $*"
|
||||
fi
|
||||
}
|
||||
|
||||
log_fatal() {
|
||||
if [ $log_level -le $FATAL ]; then
|
||||
log "FATAL $*"
|
||||
log "exiting ..."
|
||||
log "${RED}FATAL $*"
|
||||
log "${RED}exiting ..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user