global-functions: $LogPrintExit: add debugging option

This commit is contained in:
Christian Hesse 2020-03-05 08:06:43 +01:00
parent 478688d534
commit 792eba8465

View file

@ -274,19 +274,24 @@
:local Message [ :tostr $2 ]; :local Message [ :tostr $2 ];
:local Exit [ :tostr $3 ]; :local Exit [ :tostr $3 ];
:if ($Severity ~ "^(error|info)\$") do={ :global PrintDebug;
:if ($Severity ~ "^(debug|error|info)\$") do={
:if ($Severity = "debug") do={ :log debug $Message; }
:if ($Severity = "error") do={ :log error $Message; } :if ($Severity = "error") do={ :log error $Message; }
:if ($Severity = "info" ) do={ :log info $Message; } :if ($Severity = "info" ) do={ :log info $Message; }
} else={ } else={
:log warning $Message; :log warning $Message;
} }
:if ($Severity != "debug" || $PrintDebug = true) do={
:if ($Exit = "true") do={ :if ($Exit = "true") do={
:error ($Severity . ": " . $Message); :error ($Severity . ": " . $Message);
} else={ } else={
:put ($Severity . ": " . $Message); :put ($Severity . ": " . $Message);
} }
} }
}
# check if mail server is up # check if mail server is up
:set MailServerIsUp do={ :set MailServerIsUp do={