feat(logger): Add plain-text test output
This commit is contained in:
@@ -124,7 +124,15 @@ end
|
||||
|
||||
LOG_PROGRAM_NAME="cfddns"
|
||||
|
||||
if [ "$1" = "json" ]; then
|
||||
if [ "$1" = "text" ]; then
|
||||
writePlainTextLog # this will do nothing
|
||||
writePlainTextLog "Testing plain-text logging output" # this will also do nothing
|
||||
writePlainTextLog "Informational plain-text log message" "information" "ok" # info message
|
||||
writePlainTextLog "Plain-text message forced to info level" "whoops" "ok" # level translated to default
|
||||
writePlainTextLog "Warning! This is plain-text." "warning" "flagged" # warning level with 'flagged' status
|
||||
writePlainTextLog "Error sample! This is plain-text." "err" "error" # error level message
|
||||
writePlainTextLog "Unable to continue, critical failure. (This is plain-text)" "fatal" "error" # critical level error
|
||||
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
|
||||
@@ -137,7 +145,7 @@ elif [ "$1" = "journal" ]; then
|
||||
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
|
||||
else
|
||||
printf "\nPlease specify either '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
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user