Revision 12845
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
535 | 535 |
|
536 | 536 |
mk_hint() { format=7 highlight_msg "$@";} |
537 | 537 |
|
538 |
log_hint!() { log_err "$(mk_hint "$@")"; } |
|
538 |
log_err_hint!() { log_err "$(mk_hint "$@")"; }
|
|
539 | 539 |
|
540 |
log_hint() # usage: cmd || [benign_error=1] log_hint msg [|| handle error]
|
|
540 |
log_err_hint() # usage: cmd || [benign_error=1] log_err_hint msg [|| handle err]
|
|
541 | 541 |
# msg only displayed if not benign error |
542 |
{ kw_params benign_error; if test ! "$benign_error"; then log_hint! "$@"; fi; } |
|
542 |
{ |
|
543 |
kw_params benign_error |
|
544 |
if test ! "$benign_error"; then log_err_hint! "$@"; fi |
|
545 |
} |
|
543 | 546 |
|
544 | 547 |
die() # usage: cmd || [type=...] die msg # msg can use $? but not $() |
545 | 548 |
{ save_e; kw_params type; "log_${type:-err}" "$1"; rethrow; } |
... | ... | |
558 | 561 |
save_e; kw_params verbosity_min; : "${verbosity_min:?}" |
559 | 562 |
echo_vars verbosity |
560 | 563 |
if test "$(verbosity_int)" -lt "$verbosity_min"; then |
561 |
log_hint 'to see error details, prepend `vb='"$verbosity_min"'` to the command' |
|
564 |
log_err_hint 'to see error details, prepend `vb='"$verbosity_min"'` to the command'
|
|
562 | 565 |
fi |
563 | 566 |
rethrow |
564 | 567 |
} |
Also available in: Unified diff
lib/sh/util.sh: log_hint(): renamed to log_err_hint() for clarity, because this applies only to hints for errors