From aebf8042e3fda132ae54df2fc62b8789fb7ed1f4 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 24 Jul 2026 02:15:14 -0600 Subject: [PATCH] feat(params): Use badparam func to manage logging --- cfddns.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cfddns.sh b/cfddns.sh index d6b54a2..aeff1ea 100644 --- a/cfddns.sh +++ b/cfddns.sh @@ -47,7 +47,7 @@ badParam() { elif [ "$1" = "errMsg" ]; then printf "\n%sERROR: %s%s\n\n" "$err" "$2" "$norm" ([ "$logToConsole" -eq 0 ]) && writePlainTextLog \ - "$2" "critical" "fail" "preexec" 1 + "${2%%\Exit*}" "fatal" "fail" "preexec" 1 exit 1 fi } @@ -376,14 +376,10 @@ if ! command -v jq >/dev/null; then fi if [ -z "$dnsRecords" ]; then badParam errMsg "You must specify at least one DNS record to update. Exiting." - ([ "$logToConsole" -eq 0 ]) && - writePlainTextLog "At least one DNS record to update must be specified" "fatal" "fail" "params" 1 fi # verify the credentials file exists and is not empty (default check) if [ ! -f "$accountFile" ] || [ ! -s "$accountFile" ]; then - badParam errMsg "Cannot find the Cloudflare credentials file (${accountFile}). Exiting." - ([ "$logToConsole" -eq 0 ]) && - writePlainTextLog "Cannot find the specified Cloudflare credentials file (${accountFile})" "fatal" "fail" "params" 1 + badParam errMsg "Cannot find the Cloudflare credentials file (${accountFile}) or it is empty. Exiting." fi if [ "$logToJournal" -eq 1 ] && ! command -v logger >/dev/null 2>&1; then printf "\n%sThis script requires 'logger' be installed to write entries to your journaling system. Exiting.%s\n\n" "$err" "$norm"