feat(func): Write modified syslog fmt msg

Take input parameters and generate a modified syslog-style log entry.
This commit is contained in:
2026-07-23 21:59:58 -06:00
parent 8a5a72e15a
commit f8908d7830
+13
View File
@@ -71,6 +71,19 @@ standardizeLogLevels() {
esac esac
} }
# modified syslog fmt: <ISO-8601 timestamp> <hostname> <tag>[pid]: [LEVEL:$2] [STATUS:$3] <MESSAGE:$1> (<OPERATION:$4>:<CODE:$5>)
writePlainTextLog() {
# not enough information to generate a meaningful log message
if [ -z "$1" ] || [ $# -lt 3 ]; then
return
fi
printf "%s %s %s[%s]: [%s] [%s] %s (%s:%s)\n" \
"$(getTimeStamp)" "$(getHostname)" "$LOG_PROGRAM_NAME" "$$" \
"$(standardizeLogLevels "$2")" "$(uppercase "$3")" "$1" "${4:-UNSPECIFIED}" "${5:-999}" \
>>"$logFile"
}
### functions ### functions
badParam() { badParam() {
if [ "$1" = "null" ]; then if [ "$1" = "null" ]; then