Revision 9070
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/sh/util.sh | ||
---|---|---|
126 | 126 |
|
127 | 127 |
log () { if can_log; then echo "$PS4$1" >&2; fi; } |
128 | 128 |
|
129 |
# usage: symbol=... log_custom msg |
|
130 |
log_custom () { local PS4="${PS4%[^ ] }$symbol "; log "$@"; } |
|
131 |
|
|
132 |
log_err () { symbol=! log_custom "$@"; } |
|
133 |
|
|
134 |
log_info () { symbol=? log_custom "$@"; } |
|
135 |
|
|
129 | 136 |
# usage: cmd || { save_e; log_e; ...; rethrow; } |
130 | 137 |
log_e () { echo "! command exited with error $e" >&2; } |
131 | 138 |
|
Also available in: Unified diff
lib/sh/util.sh: verbose output: added log_custom (), which modifies the symbol in PS4 to indicate the message type, and log_err ()/log_info (), which set specific symbols