Revision 8919
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
65 | 65 |
|
66 | 66 |
can_log () { test "$verbosity" -gt 0; } # verbosity=0 turns off all logging |
67 | 67 |
|
68 |
: "${log_indent=' '}" |
|
69 |
|
|
68 | 70 |
# usage: in func: inc_log_level; ... |
69 | 71 |
# outside func: inc_log_level; ...; dec_log_level |
70 |
alias inc_log_level='declare verbosity="$verbosity"; let verbosity--' |
|
71 |
alias dec_log_level='declare verbosity="$verbosity"; let verbosity++' |
|
72 |
alias inc_log_level='declare verbosity="$verbosity" PS4="$log_indent$PS4" |
|
73 |
let verbosity--' |
|
74 |
alias dec_log_level='declare verbosity="$verbosity" PS4="${PS4#$log_indent}" |
|
75 |
let verbosity++' |
|
72 | 76 |
|
73 | 77 |
# usage: (log_stderr; cmd...) || exit |
74 | 78 |
# `|| exit` needed on Mac because of bug where -e doesn't apply to () |
Also available in: Unified diff
lib/util.sh: inc/dec_log_level: indent commands at higher log levels using $log_indent