feat(func): Write modified syslog fmt msg
Take input parameters and generate a modified syslog-style log entry.
This commit is contained in:
@@ -71,6 +71,19 @@ standardizeLogLevels() {
|
||||
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
|
||||
badParam() {
|
||||
if [ "$1" = "null" ]; then
|
||||
|
||||
Reference in New Issue
Block a user