diff options
-rw-r--r-- | bash-lib.sh | 8 | ||||
-rw-r--r-- | demo.sh | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/bash-lib.sh b/bash-lib.sh index 83819df..b2bb3df 100644 --- a/bash-lib.sh +++ b/bash-lib.sh | |||
@@ -30,14 +30,14 @@ readonly CYAN | |||
30 | WHITE="$(tput setaf 7)" | 30 | WHITE="$(tput setaf 7)" |
31 | readonly WHITE | 31 | readonly WHITE |
32 | 32 | ||
33 | readonly BASH_LIB_DEBUG_VAR="${BASH_LIB_NAME:-BASH}_DEBUG" | 33 | readonly BASH_LIB_LOG_VAR="${BASH_LIB_NAME:-BASH}_LOG" |
34 | 34 | ||
35 | is_debug() { | 35 | is_debug() { |
36 | [ "${!BASH_LIB_DEBUG_VAR:-0}" -ge 1 ] | 36 | [ "${!BASH_LIB_LOG_VAR:-0}" -ge 1 ] |
37 | } | 37 | } |
38 | 38 | ||
39 | is_trace() { | 39 | is_trace() { |
40 | [ "${!BASH_LIB_DEBUG_VAR:-0}" -ge 2 ] | 40 | [ "${!BASH_LIB_LOG_VAR:-0}" -ge 2 ] |
41 | } | 41 | } |
42 | 42 | ||
43 | declare -a VERBOSE_ARG | 43 | declare -a VERBOSE_ARG |
@@ -89,7 +89,7 @@ error() { | |||
89 | critical() { | 89 | critical() { |
90 | error "$@" | 90 | error "$@" |
91 | # Useful for triggering the error trap system | 91 | # Useful for triggering the error trap system |
92 | false | 92 | return 1 |
93 | } | 93 | } |
94 | 94 | ||
95 | fatal() { | 95 | fatal() { |
@@ -3,8 +3,8 @@ | |||
3 | readonly BASH_LIB_NAME=DEMO | 3 | readonly BASH_LIB_NAME=DEMO |
4 | source ./bash-lib.sh | 4 | source ./bash-lib.sh |
5 | 5 | ||
6 | # Set `DEMO_DEBUG=1` to enable debug messages | 6 | # Set `DEMO_LOG=1` to enable debug messages |
7 | # Set `DEMO_DEBUG=2` to enable trace messages | 7 | # Set `DEMO_LOG=2` to enable trace messages |
8 | 8 | ||
9 | trace "this is a trace message" "with additional data" | 9 | trace "this is a trace message" "with additional data" |
10 | debug "this is a debugging message" "with additional data" | 10 | debug "this is a debugging message" "with additional data" |