From 832c0ca24e91ba9a7a95a5597a73b40fa0b5297a Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Mon, 6 Sep 2021 10:30:25 -0400 Subject: [PATCH] Add NOTICE level logging --- scriptTemplate.sh | 8 +++++++- utilities/alerts.bash | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scriptTemplate.sh b/scriptTemplate.sh index 69a493b..64ee046 100755 --- a/scriptTemplate.sh +++ b/scriptTemplate.sh @@ -176,6 +176,11 @@ _alert_() { _writeToLog_ fi ;; + NOTICE | notice | Notice) + if [[ ${alertType} =~ ^(die|error|fatal|warning|notice|success) ]]; then + _writeToLog_ + fi + ;; WARN | warn | Warn) if [[ ${alertType} =~ ^(die|error|fatal|warning) ]]; then _writeToLog_ @@ -413,7 +418,8 @@ _usage_() { ${bold}Options:${reset} -h, --help Display this help and exit - --loglevel [LEVEL] One of: FATAL, ERROR, WARN, INFO, DEBUG, ALL, OFF (Default is 'ERROR') + --loglevel [LEVEL] One of: FATAL, ERROR, WARN, INFO, NOTICE, DEBUG, ALL, OFF + (Default is 'ERROR') --logfile [FILE] Full PATH to logfile. (Default is '${HOME}/logs/$(basename "$0").log') -n, --dryrun Non-destructive. Makes no permanent changes. -q, --quiet Quiet (no output) diff --git a/utilities/alerts.bash b/utilities/alerts.bash index 59706d0..b1ddf01 100644 --- a/utilities/alerts.bash +++ b/utilities/alerts.bash @@ -137,6 +137,11 @@ _alert_() { _writeToLog_ fi ;; + NOTICE | notice | Notice) + if [[ ${alertType} =~ ^(die|error|fatal|warning|notice|success) ]]; then + _writeToLog_ + fi + ;; WARN | warn | Warn) if [[ ${alertType} =~ ^(die|error|fatal|warning) ]]; then _writeToLog_