Project

General

Profile

« Previous | Next » 

Revision 8900

lib/util.sh: verbose output: added inc_log_level, dec_log_level aliases which manipulate $verbosity. note that changes in $log_level are now instead indicated by moving $verbosity in the opposite direction.

View differences:

util.sh
58 58

  
59 59
can_log () { test "$verbosity" -gt 0; } # verbosity=0 turns off all logging
60 60

  
61
# usage: in func:      inc_log_level; ...
62
#        outside func: inc_log_level; ...; dec_log_level
63
alias inc_log_level='declare verbosity="$verbosity"; let verbosity--'
64
alias dec_log_level='declare verbosity="$verbosity"; let verbosity++'
65

  
61 66
echo_cmd () { if can_log; then echo "$PS4$*" >&2; fi; }
62 67

  
63 68
echo_run () { echo_cmd "$@"; "$@"; }

Also available in: Unified diff