Revision 9289
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 |
: "${log_level_indent=| }" "${log_indent=}" |
|
182 |
export log_level_indent log_indent # propagate to invoked commands |
|
183 |
|
|
184 |
__caller_indent='log_indent="$log_indent$log_level_indent"' |
|
185 |
alias caller_indent="$__caller_indent" |
|
186 |
alias indent="declare $__caller_indent" |
|
187 |
|
|
188 | 181 |
# usage: in func: PS4++; ... |
189 | 182 |
# outside func: PS4++; ...; PS4-- |
190 | 183 |
alias PS4++='declare PS4="${PS4:0:1}$PS4"' |
... | ... | |
195 | 188 |
alias log++='{ PS4++; declare verbosity="$verbosity"; let! verbosity--; }' |
196 | 189 |
alias log--='{ PS4--; declare verbosity="$verbosity"; let! verbosity++; }' |
197 | 190 |
|
191 |
|
|
192 |
# indent for call tree. this is *not* the log_level (below). |
|
193 |
: "${log_level_indent=| }" "${log_indent=}" |
|
194 |
export log_level_indent log_indent # propagate to invoked commands |
|
195 |
|
|
196 |
__caller_indent='log_indent="$log_indent$log_level_indent"' |
|
197 |
alias caller_indent="$__caller_indent" |
|
198 |
alias indent="declare $__caller_indent" |
|
199 |
|
|
200 |
|
|
198 | 201 |
fi # load new aliases |
199 | 202 |
if self_being_included; then |
200 | 203 |
|
Also available in: Unified diff
lib/sh/util.sh: logging: moved indent for call tree to its own section, so it isn't confused with the log_level