convert to upper case, add function

This commit is contained in:
Jakobus Schürz 2020-10-08 06:28:19 +02:00
parent 03d0bda623
commit 58bcb86901

View file

@ -807,8 +807,8 @@ setloglevel () {
local oldloglevel=${LOGLEVEL-$LOGLEVEL_DEFAULT} local oldloglevel=${LOGLEVEL-$LOGLEVEL_DEFAULT}
declare -a loglevels declare -a loglevels
loglevels=("ERROR" "WARN" "INFO" "DEBUG" "TRACE") loglevels=("ERROR" "WARN" "INFO" "DEBUG" "TRACE")
if [[ ${loglevels[*]} =~ "$1" ]]; then if [[ ${loglevels[*]} =~ "${1^^}" ]]; then
export LOGLEVEL=$1 export LOGLEVEL=${1^^}
else else
logerror "LOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE" logerror "LOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
fi fi
@ -831,4 +831,15 @@ setfileloglevel () {
EXIT EXIT
} }
getloglevels () {
ENTRY
cat << EOF
LOGLEVEL: ${LOGLEVEL-${LOGLEVEL_DEFAULT}}
FILELOGLEVEL: ${FILELOGLEVEL-${FILELOGLEVEL_DEFAULT}}
change LOGLEVEL: \$ setloglevel [ERROR|WARN|INFO|DEBUG|TRACE]
change FILELOGLEVEL: \$ setfileloglevel [ERROR|WARN|INFO|DEBUG|TRACE]
EOF
}
#EOF #EOF