Revision 9396
Added by Aaron Marcuse-Kubitza over 11 years ago
util.sh | ||
---|---|---|
209 | 209 |
export verbosity # propagate to invoked commands |
210 | 210 |
export PS4 # follows verbosity, so also propagate this |
211 | 211 |
|
212 |
verbosity_int() { round_down "$verbosity"; } |
|
213 |
|
|
212 | 214 |
# verbosities: |
213 | 215 |
# 0: just print errors. useful for cron jobs. |
214 | 216 |
# 1: also external commands run. useful for running at the command line. |
... | ... | |
258 | 260 |
fi # load new aliases |
259 | 261 |
if self_being_included; then |
260 | 262 |
|
261 |
can_log() { test "$(round_down "$verbosity")" -gt 0; }
|
|
263 |
can_log() { test "$(verbosity_int)" -gt 0; }
|
|
262 | 264 |
# verbosity=0 turns off all logging |
263 | 265 |
|
264 | 266 |
log() { if can_log; then echo "$log_indent$PS4$1" >&"$log_fd"; fi; } |
Also available in: Unified diff
lib/sh/util.sh: logging: added verbosity_int() and use it instead of `round_down "$verbosity"`