add support for __cdist_debug={0,1,2}

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-07 10:07:04 +02:00
parent 74418c77e0
commit c3bf34bf3d
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -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 "$@"