Revision 12858
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
518 | 518 |
can_log() { test "$log_level" -le "$(verbosity_int)"; } |
519 | 519 |
# verbosity=0 turns off all logging |
520 | 520 |
|
521 |
can_highlight_msg() { test "$log_level" -le 1; } |
|
521 |
can_highlight_log_msg() { test "$log_level" -le 1; }
|
|
522 | 522 |
|
523 |
highlight_msg() # usage: [format=...] highlight_msg msg
|
|
523 |
highlight_log_msg() # usage: [format=...] highlight_log_msg msg
|
|
524 | 524 |
# format: the # in xfree86.org/current/ctlseqs.html#Character_Attributes |
525 | 525 |
{ |
526 | 526 |
kw_params format; local format="${format-1}" # bold |
527 |
if ! can_highlight_msg; then format=; fi |
|
527 |
if ! can_highlight_log_msg; then format=; fi
|
|
528 | 528 |
format "$format" "$1" |
529 | 529 |
} |
530 | 530 |
|
531 | 531 |
log_line!() # highlights log_level 1 messages to stand out against other output |
532 |
{ echo "$log_indent$PS4$(highlight_msg "$1")" >&"$log_fd"; } |
|
532 |
{ echo "$log_indent$PS4$(highlight_log_msg "$1")" >&"$log_fd"; }
|
|
533 | 533 |
|
534 | 534 |
log_msg!() |
535 | 535 |
{ split_lines "$1"; local l; for l in "${lines[@]}"; do log_line! "$l"; done; } |
... | ... | |
545 | 545 |
|
546 | 546 |
log_info() { symbol=: log_custom "$@"; } |
547 | 547 |
|
548 |
mk_hint() { format=7 highlight_msg "$@";} |
|
548 |
mk_hint() { format=7 highlight_log_msg "$@";}
|
|
549 | 549 |
|
550 | 550 |
log_err_hint!() { log_err "$(mk_hint "$@")"; } |
551 | 551 |
|
Also available in: Unified diff
lib/sh/util.sh: highlight_msg(): renamed to highlight_log_msg() to clarify that this contains log++-specific functionality