feat(logger): Update test cases
Update JSON and JOURNALD tests to match text tests and use new functions.
This commit is contained in:
@@ -133,17 +133,21 @@ if [ "$1" = "text" ]; then
|
|||||||
writePlainTextLog "Error sample! This is plain-text." "err" "error" # error level message
|
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
|
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
|
elif [ "$1" = "json" ]; then
|
||||||
writeJsonLog # this will generate a generic error message
|
writeJsonLog # this will do nothing
|
||||||
writeJsonLog "This is a test message" # generate this message at the default level with the default code
|
writeJsonLog "This is a test message" # this will also do nothing
|
||||||
writeJsonLog "This is a test message" "warning" # generate this message at the 'warning' level with the default code
|
writeJsonLog "Informational JSON log message" "information" "ok" # info message
|
||||||
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 "JSON message forced to info level" "whoops" "ok" # level translated to default
|
||||||
writeJsonLog "This is a test message" "alert" "testing" 10 # generate this message at the 'alert' level with all parameters set
|
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
|
elif [ "$1" = "journal" ]; then
|
||||||
writeJournalDLog # this will generate a generic error message
|
writeJournalDLog # this will do nothing
|
||||||
writeJournalDLog "This is a test message" # generate this message at the default level with the default code
|
writeJournalDLog "This is a test message" # this will also do nothing
|
||||||
writeJournalDLog "This is a test message" "warning" # generate this message at the 'warning' level with the default code
|
writeJournalDLog "Informational JOURNALD log message" "information" "ok" # info message
|
||||||
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 "JOURNALD message forced to info level" "whoops" "ok" # level translated to default
|
||||||
writeJournalDLog "This is a test message" "alert" "testing" 10 # generate this message at the 'alert' level with all parameters set
|
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
|
else
|
||||||
printf "\nPlease specify either 'text', 'json', or 'journal' after the script name. Exiting.\n\n"
|
printf "\nPlease specify either 'text', 'json', or 'journal' after the script name. Exiting.\n\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user