feat(logger): Update test cases

Update JSON and JOURNALD tests to match text tests and use new functions.
This commit is contained in:
2026-07-22 23:48:16 -06:00
parent c4d28d1f8c
commit d0b2c781bf
+14 -10
View File
@@ -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