summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2021-11-09 11:23:21 +0100
committerMinijackson <minijackson@riseup.net>2021-11-09 11:23:21 +0100
commitb2bd7818410e42e9a393553e7807037df8546a67 (patch)
tree88bfcdd446e03b7c16e54b6a1cc27eee8ba5b230
parent4436c8197859ddf61e72c465d39c9eed55af51ba (diff)
downloadbash-lib-b2bd7818410e42e9a393553e7807037df8546a67.tar.gz
bash-lib-b2bd7818410e42e9a393553e7807037df8546a67.zip
use BASH_LOG instead of BASH_DEBUG
-rw-r--r--bash-lib.sh8
-rw-r--r--demo.sh4
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
30WHITE="$(tput setaf 7)" 30WHITE="$(tput setaf 7)"
31readonly WHITE 31readonly WHITE
32 32
33readonly BASH_LIB_DEBUG_VAR="${BASH_LIB_NAME:-BASH}_DEBUG" 33readonly BASH_LIB_LOG_VAR="${BASH_LIB_NAME:-BASH}_LOG"
34 34
35is_debug() { 35is_debug() {
36 [ "${!BASH_LIB_DEBUG_VAR:-0}" -ge 1 ] 36 [ "${!BASH_LIB_LOG_VAR:-0}" -ge 1 ]
37} 37}
38 38
39is_trace() { 39is_trace() {
40 [ "${!BASH_LIB_DEBUG_VAR:-0}" -ge 2 ] 40 [ "${!BASH_LIB_LOG_VAR:-0}" -ge 2 ]
41} 41}
42 42
43declare -a VERBOSE_ARG 43declare -a VERBOSE_ARG
@@ -89,7 +89,7 @@ error() {
89critical() { 89critical() {
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
95fatal() { 95fatal() {
diff --git a/demo.sh b/demo.sh
index 3de6e35..96ab4d3 100644
--- a/demo.sh
+++ b/demo.sh
@@ -3,8 +3,8 @@
3readonly BASH_LIB_NAME=DEMO 3readonly BASH_LIB_NAME=DEMO
4source ./bash-lib.sh 4source ./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
9trace "this is a trace message" "with additional data" 9trace "this is a trace message" "with additional data"
10debug "this is a debugging message" "with additional data" 10debug "this is a debugging message" "with additional data"