From d0b2c781bff1d5eec97505b75dabf0b2fa68b2b8 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 22 Jul 2026 23:48:16 -0600 Subject: [PATCH] feat(logger): Update test cases Update JSON and JOURNALD tests to match text tests and use new functions. --- logger.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/logger.sh b/logger.sh index 3cbe0d2..f869a19 100644 --- a/logger.sh +++ b/logger.sh @@ -133,17 +133,21 @@ if [ "$1" = "text" ]; then writePlainTextLog "Error sample! This is plain-text." "err" "error" # error level message writePlainTextLog "Unable to continue, critical failure. (This is plain-text)" "fatal" "exit" "startup" "2" # critical level error with operation and error code elif [ "$1" = "json" ]; then - writeJsonLog # this will generate a generic error message - writeJsonLog "This is a test message" # generate this message at the default level with the default code - writeJsonLog "This is a test message" "warning" # generate this message at the 'warning' level with the default code - writeJsonLog "This is a test message" "error" "testing" # generate this message at the 'error' level, part of a 'test' operation, and with the default code - writeJsonLog "This is a test message" "alert" "testing" 10 # generate this message at the 'alert' level with all parameters set + writeJsonLog # this will do nothing + writeJsonLog "This is a test message" # this will also do nothing + writeJsonLog "Informational JSON log message" "information" "ok" # info message + writeJsonLog "JSON message forced to info level" "whoops" "ok" # level translated to default + writeJsonLog "Warning! This is JSON." "warning" "flagged" # warning level with 'flagged' status + writeJsonLog "Error sample! This is JSON." "err" "error" # error level message + writeJsonLog "Unable to continue, critical failure. (This is JSON)" "fatal" "exit" "startup" "2" # critical level error with operation and error code elif [ "$1" = "journal" ]; then - writeJournalDLog # this will generate a generic error message - writeJournalDLog "This is a test message" # generate this message at the default level with the default code - writeJournalDLog "This is a test message" "warning" # generate this message at the 'warning' level with the default code - writeJournalDLog "This is a test message" "error" "testing" # generate this message at the 'error' level as part of a 'test' operation, and with the default code - writeJournalDLog "This is a test message" "alert" "testing" 10 # generate this message at the 'alert' level with all parameters set + writeJournalDLog # this will do nothing + writeJournalDLog "This is a test message" # this will also do nothing + writeJournalDLog "Informational JOURNALD log message" "information" "ok" # info message + writeJournalDLog "JOURNALD message forced to info level" "whoops" "ok" # level translated to default + writeJournalDLog "Warning! This is a JOURNALD message." "warning" "flagged" # warning level with 'flagged' status + writeJournalDLog "Error sample! This is a JOURNALD." "err" "error" # error level message + writeJournalDLog "Unable to continue, critical failure. (This is JOURNALD message)" "fatal" "exit" "startup" "2" # critical level error with operation and error code else printf "\nPlease specify either 'text', 'json', or 'journal' after the script name. Exiting.\n\n" exit 1