Merge branch 'master' of /srv/git/myshellconfig

This commit is contained in:
Jakobus Schürz 2020-10-25 11:26:11 +01:00
commit 5d02dcee0f
2 changed files with 48 additions and 1 deletions

View file

@ -96,7 +96,7 @@ logdebug "update submodules"
logdebug "update submodules ENDE"
else
logdebug "Do not update submodules. It's denied by environment MYSHELLCONFIG_GIT_UPDATE_SUBMODULES: ${MYSHELLCONFIG_GIT_UPDATE_SUBMODLUES-${MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT-true}}"
logdebug "Do not update submodules. It's denied by environment MYSHELLCONFIG_GIT_UPDATE_SUBMODULES: ${MYSHELLCONFIG_GIT_UPDATE_SUBMODULES-${MYSHELLCONFIG_GIT_UPDATE_SUBMODULES_DEFAULT-true}}"
fi
EXIT

47
bin/testlog Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
LANG=C
for f in logerror logwarn 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"
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
logerror "ich bin ein error"
logwarn "ich bin eine warnung"
loginfo "ich bin eine info"
logdebug "ich bin eine debuginfo"
logtrace "ich rede zuviel"
ENTRY "ich starte eine function"
EXIT "ich beende eine function"
SCRIPTENTRY "ich starte ein script"
SCRIPTEXIT "ich beende ein script"