We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 903fd74 commit 73b0b0dCopy full SHA for 73b0b0d
example/verbose.sh
@@ -0,0 +1,15 @@
1
+#!/usr/bin/env bash
2
+source "$(cd "${BASH_SOURCE[0]%/*}" && pwd)/../lib/oo-bootstrap.sh"
3
+
4
+import util/log
5
6
+namespace test/verbose
7
+VERBOSE=2
8
9
+Log::AddOutput test/verbose DEBUG
10
11
+Log "this log will be printed"
12
+V=2 Log "this log will be displayed"
13
14
+VERBOSE=1
15
+V=2 Log "this log will not be displayed"
lib/util/log.sh
@@ -36,6 +36,12 @@ Log::DisableFilter() {
36
}
37
38
Log() {
39
+ # support verbosing logging
40
+ local V="${V:-0}"
41
+ if [[ $VERBOSE < $V ]]; then
42
+ return
43
+ fi
44
45
local callingFunction="${FUNCNAME[1]}"
46
local callingScript="${BASH_SOURCE[1]}"
47
local scope
0 commit comments