[params] Create journal logging switch

Create boolean variable to store journal logging preference.
Set to 'false' by default. Add parameter to activate this preference.
Update help to include this new parameter.
This commit is contained in:
2026-07-19 18:49:34 -06:00
parent c7297a512c
commit 5c6c8ec4ea
+9
View File
@@ -157,6 +157,10 @@ scriptHelp() {
textBlock "Switch value. Output log to console (stdout) instead of a log file. Can be combined with --nc if desired." textBlock "Switch value. Output log to console (stdout) instead of a log file. Can be combined with --nc if desired."
textBlockDefaults "(disabled: output to log file)" textBlockDefaults "(disabled: output to log file)"
newline newline
textBlockSwitches "--log-journal"
textBlock "Switch value. Output a structured log entry to your journaling system instead of a log file. Implies --nc."
textBlockDefaults "(disabled: output to log file)"
newline
textBlockSwitches "--no-log" textBlockSwitches "--no-log"
textBlock "Switch value. Do not create a log (i.e. no console, no file). You will not have *any* output from the script if you choose this option, so you will not know if updates succeeded or failed." textBlock "Switch value. Do not create a log (i.e. no console, no file). You will not have *any* output from the script if you choose this option, so you will not know if updates succeeded or failed."
textBlockDefaults "(disabled: output to log file)" textBlockDefaults "(disabled: output to log file)"
@@ -253,6 +257,7 @@ writeLog() {
scriptPath="$(CDPATH='' \cd -- "$(dirname -- "$0")" && pwd -P)" scriptPath="$(CDPATH='' \cd -- "$(dirname -- "$0")" && pwd -P)"
scriptName="$(basename "$0")" scriptName="$(basename "$0")"
logFile="$scriptPath/${scriptName%.*}.log" logFile="$scriptPath/${scriptName%.*}.log"
logToJournal=0
accountFile="$scriptPath/cloudflare.credentials" accountFile="$scriptPath/cloudflare.credentials"
colourizeLogFile=1 colourizeLogFile=1
dnsRecords="" dnsRecords=""
@@ -292,6 +297,10 @@ while [ $# -gt 0 ]; do
# log to the console instead of a file # log to the console instead of a file
logFile="/dev/stdout" logFile="/dev/stdout"
;; ;;
--log-journal)
# log to the journal system instead of a file
logToJournal=1
;;
--no-log) --no-log)
# do not log anything # do not log anything
logFile="/dev/null" logFile="/dev/null"