add support for __cdist_debug={0,1,2}
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
74418c77e0
commit
c3bf34bf3d
2 changed files with 11 additions and 5 deletions
|
@ -21,8 +21,16 @@
|
||||||
|
|
||||||
__cdist_version="1.8.0"
|
__cdist_version="1.8.0"
|
||||||
|
|
||||||
# Enable debugging
|
#
|
||||||
[ "$__cdist_debug" ] && set -x
|
# Enable debugging:
|
||||||
|
#
|
||||||
|
# __cdist_debug unset -> no debug
|
||||||
|
# __cdist_debug = 1 -> debug via __cdist_echo
|
||||||
|
# __cdist_debug = 2 -> debug via set -x
|
||||||
|
#
|
||||||
|
|
||||||
|
: ${__cdist_debug:=0}
|
||||||
|
[ "$__cdist_debug" = 2 ] && set -x
|
||||||
|
|
||||||
# Fail if something bogus is going on
|
# Fail if something bogus is going on
|
||||||
set -u
|
set -u
|
||||||
|
|
|
@ -35,11 +35,9 @@ __cdist_echo()
|
||||||
|
|
||||||
case "$__cdist_echo_type" in
|
case "$__cdist_echo_type" in
|
||||||
debug)
|
debug)
|
||||||
set +u
|
if [ "$__cdist_debug" = 1 ]; then
|
||||||
if [ "$__cdist_debug" ]; then
|
|
||||||
echo $__cdist_echo_prefix "Debug: $@"
|
echo $__cdist_echo_prefix "Debug: $@"
|
||||||
fi
|
fi
|
||||||
set -u
|
|
||||||
;;
|
;;
|
||||||
info)
|
info)
|
||||||
echo $__cdist_echo_prefix "$@"
|
echo $__cdist_echo_prefix "$@"
|
||||||
|
|
Loading…
Reference in a new issue