add function to change loglevel

This commit is contained in:
Jakobus Schürz 2020-09-21 21:52:34 +02:00
parent 866a059ad1
commit 543484d51c

View file

@ -793,3 +793,14 @@ ssh-runinagent () {
fi
}
changeloglevel () {
local loglevels
declare -a loglevels
loglevels=("ERROR" "WARN" "INFO" "DEBUG" "TRACE")
if [[ ${loglevels[*]} =~ $1 ]]; then
export LOGLEVEL=$1
else
logerror "LOGLEVEL must be one of ERROR, WARN, INFO, DEBUG or TRACE"
fi
}