Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8540fe16b2 | |||
| 1fb44db8df | |||
| 1144156613 | |||
| 45e5e17513 | |||
| a92b341bc3 |
Generated
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="com.itcodebox.notebooks.projectservice.ProjectUIState">
|
<component name="com.itcodebox.notebooks.projectservice.ProjectUIState">
|
||||||
<option name="selectedNotebookId" value="1" />
|
<option name="selectedNotebookId" value="1" />
|
||||||
<option name="selectedChapterId" value="1" />
|
<option name="selectedChapterId" value="2" />
|
||||||
<option name="selectedNoteId" value="1" />
|
<option name="selectedNoteId" value="2" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -113,6 +113,56 @@ standardizeLogLevels() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
translateLogLevelsToJournalD() {
|
||||||
|
LEVEL_TO_TRANSLATE="$(standardizeLogLevels "$1")"
|
||||||
|
case "$LEVEL_TO_TRANSLATE" in
|
||||||
|
"CRIT")
|
||||||
|
echo 2
|
||||||
|
;;
|
||||||
|
"ERR")
|
||||||
|
echo 3
|
||||||
|
;;
|
||||||
|
"WARN")
|
||||||
|
echo 4
|
||||||
|
;;
|
||||||
|
"INFO")
|
||||||
|
echo 6
|
||||||
|
;;
|
||||||
|
"DEBUG")
|
||||||
|
echo 7
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo 6
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: message, $2: level, $3: status, [$4: operation], [$5: code]
|
||||||
|
writeJournalDLog() {
|
||||||
|
# not enough information to generate a meaningful log message
|
||||||
|
if [ -z "$1" ] || [ $# -lt 3 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
J_TIMESTAMP="$(getTimeStamp)"
|
||||||
|
J_PID="$$"
|
||||||
|
J_PRIO="$(translateLogLevelsToJournalD "$2")"
|
||||||
|
J_STAT="$(uppercase "$3")"
|
||||||
|
|
||||||
|
logger --journald <<end
|
||||||
|
SYSLOG_TIMESTAMP=${J_TIMESTAMP}
|
||||||
|
SYSLOG_FACILITY=3
|
||||||
|
SYSLOG_IDENTIFIER=${LOG_PROGRAM_NAME}
|
||||||
|
SYSLOG_PID=${J_PID}
|
||||||
|
PRIORITY=${J_PRIO}
|
||||||
|
STATUS=${J_STAT}
|
||||||
|
MESSAGE=$1
|
||||||
|
OPERATION=${4:-UNSPECIFIED}
|
||||||
|
ERRNO=${5:-0}
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
# $1: message, $2: level, $3: status, [$4: operation], [$5: code]
|
# $1: message, $2: level, $3: status, [$4: operation], [$5: code]
|
||||||
writeJsonLog() {
|
writeJsonLog() {
|
||||||
# not enough information to generate a meaningful log message
|
# not enough information to generate a meaningful log message
|
||||||
@@ -157,9 +207,9 @@ writeLog() {
|
|||||||
PT_LOG_LEVEL="$(standardizeLogLevels "$2")"
|
PT_LOG_LEVEL="$(standardizeLogLevels "$2")"
|
||||||
([ "$logDebug" -eq 0 ] && [ "$PT_LOG_LEVEL" = "DEBUG" ]) && return
|
([ "$logDebug" -eq 0 ] && [ "$PT_LOG_LEVEL" = "DEBUG" ]) && return
|
||||||
|
|
||||||
([ "$logToJournal" -eq 1 ]) && return # TODO: replace this with function when implemented
|
([ "$logToJournal" -eq 1 ]) && writeJournalDLog "$@" && return
|
||||||
([ "$useJsonLogFmt" -eq 1 ]) && writeJsonLog "$@"
|
([ "$useJsonLogFmt" -eq 1 ]) && writeJsonLog "$@" && return
|
||||||
([ "$useSyslogLogFmt" -eq 1 ]) && writePlainTextLog "$@"
|
([ "$useSyslogLogFmt" -eq 1 ]) && writePlainTextLog "$@" && return
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptExamples() {
|
scriptExamples() {
|
||||||
|
|||||||
Reference in New Issue
Block a user