Skip to content

Commit

Permalink
Fix logging function logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjurkiewicz committed Aug 18, 2014
1 parent ea22a2e commit bafc56d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions acts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@ set -e
starttime=$(date +%s)

verbose=0 # set this so we can define the log_functions early
log_message() { [ "$verbose" -ge 0 ] && echo "$@" >&2 || true ; } # FIXME: Need the "|| true" because of set -e. Is there a better workaround?
log_verbose() { [ "$verbose" -ge 1 ] && echo "$@" >&2 || true ; }
log_debug() { [ "$verbose" -ge 2 ] && echo "$@" >&2 || true ; }
log_message() {
if [ "$verbose" -ge 0 ] ; then
echo "$@" >&2
fi
}
log_verbose() {
if [ "$verbose" -ge 1 ] ; then
echo "$@" >&2
fi
}
log_debug() {
if [ "$verbose" -ge 2 ] ; then
echo "$@" >&2
fi
}

# PART 1: Initialisation
if [ -f acts.conf ] ; then
Expand Down

0 comments on commit bafc56d

Please sign in to comment.