Revision 9300
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
178 | 178 |
# for unfiltered messages, the log_level is 0 (i.e. still output at verbosity=0) |
179 | 179 |
# to view a message's log_level, count the # of + signs before it in the output |
180 | 180 |
|
181 |
# usage: in func: PS4++; ... OR PS4_local; "PS4++"; ... |
|
182 |
# outside func: PS4++; ...; PS4-- |
|
183 |
PS4++() { PS4="${PS4:0:1}$PS4"; } |
|
184 |
PS4--() { PS4="${PS4#${PS4:0:1}}"; } |
|
185 |
alias PS4_local='declare PS4="$PS4"' |
|
186 |
alias PS4++='PS4_local; "PS4++"' |
|
187 |
alias PS4--='PS4_local; "PS4--"' |
|
188 |
|
|
189 | 181 |
# usage: in func: log++; ... OR log_local; "log++"; ... |
190 | 182 |
# outside func: log++; ...; log-- |
191 |
log++() { "PS4++"; let! verbosity--; }
|
|
192 |
log--() { "PS4--"; let! verbosity++; }
|
|
193 |
alias log_local='PS4_local; declare verbosity="$verbosity"'
|
|
183 |
log++() { PS4="${PS4:0:1}$PS4"; let! verbosity--; }
|
|
184 |
log--() { PS4="${PS4#${PS4:0:1}}"; let! verbosity++; }
|
|
185 |
alias log_local='declare PS4="$PS4" verbosity="$verbosity"'
|
|
194 | 186 |
alias log++='log_local; "log++"' |
195 | 187 |
alias log--='log_local; "log--"' |
196 | 188 |
|
Also available in: Unified diff
lib/sh/util.sh: logging: inlined PS4 functions into log++/-- because that's the only place they're used and it greatly simplifies the code