change logging
This commit is contained in:
parent
4047123683
commit
2bea15b5cd
1 changed files with 0 additions and 34 deletions
|
@ -3,40 +3,6 @@
|
|||
FILELOGLEVEL=DEBUG
|
||||
# loggerfactory
|
||||
LANG=C
|
||||
for f in logerror logwarning loginfo logdebug logtrace ENTRY EXIT SCRIPTENTRY SCRIPTEXIT; do
|
||||
if LANG=C type -t $f 2> /dev/null| grep -q 'function'; then
|
||||
:
|
||||
else
|
||||
fx=${f//log/}
|
||||
echo create function $f for $fx >&2
|
||||
eval "$f () { \
|
||||
local loglevels; \
|
||||
declare -a loglevels; \
|
||||
case $fx in
|
||||
error)
|
||||
loglevels=()
|
||||
;;
|
||||
warn)
|
||||
loglevels=(\"ERROR\")
|
||||
;;
|
||||
info)
|
||||
loglevels=(\"ERROR\" \"WARN\" )
|
||||
;;
|
||||
debug)
|
||||
loglevels=( \"ERROR\" \"WARN\" \"INFO\" )
|
||||
;;
|
||||
trace|ENTRY|EXIT|SCRIPTENTRY|SCRIPTEXIT)
|
||||
loglevels=( \"ERROR\" \"WARN\" \"INFO\" \"DEBUG\" )
|
||||
;;
|
||||
esac
|
||||
if [[ ! \${loglevels[*]} =~ \"\${LOGLEVEL-\${LOGLEVEL_DEFAULT}}\" ]];then \
|
||||
echo "\$@" >&2
|
||||
fi; \
|
||||
}"
|
||||
unset fx
|
||||
fi
|
||||
done
|
||||
unset f
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
|
|
Loading…
Reference in a new issue