aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-02-26 12:09:19 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-02-26 12:09:19 +0100
commit3ebf68a08c94e23d742a37815caa3c55b6985806 (patch)
tree86ff5ab9d07d34e5794857b1f22caae220cc5f2f
parent6ef764c7d7dc855dc40313fbe79702d6949b7abb (diff)
global-functions: $LogAndError: add severity
-rw-r--r--check-certificates2
-rw-r--r--check-routeros-update4
-rw-r--r--email-backup2
-rw-r--r--global-functions7
-rw-r--r--ipv6-update2
-rw-r--r--lease-script2
-rw-r--r--packages-update2
-rw-r--r--ppp-on-up2
-rw-r--r--sms-action2
-rw-r--r--sms-forward2
-rw-r--r--update-tunnelbroker2
-rw-r--r--upload-backup2
12 files changed, 16 insertions, 15 deletions
diff --git a/check-certificates b/check-certificates
index ccc7b15..d7c4c8e 100644
--- a/check-certificates
+++ b/check-certificates
@@ -22,7 +22,7 @@
}
:if ($TimeIsSync = false) do={
- $LogAndError "Time is not yet synchronized.";
+ $LogAndError warning "Time is not yet synchronized.";
}
:foreach Cert in=[ / certificate find where !revoked !ca expires-after<3w ] do={
diff --git a/check-routeros-update b/check-routeros-update
index 7f14701..ff5bc38 100644
--- a/check-routeros-update
+++ b/check-routeros-update
@@ -25,7 +25,7 @@
:if ([ / system package print count-only where name="wireless" disabled=no ] > 0) do={
:if ([ / interface wireless cap get enabled ] = true && \
[ / caps-man manager get enabled ] = false) do={
- $LogAndError "System is managed by CAPsMAN, not checking.";
+ $LogAndError error "System is managed by CAPsMAN, not checking.";
}
}
@@ -37,7 +37,7 @@
:local Update [ / system package update get ];
:if ([ :len ($Update->"latest-version") ] = 0) do={
- $LogAndError "An empty string is not a valid version.";
+ $LogAndError warning "An empty string is not a valid version.";
}
:if ($Update->"installed-version" != $Update->"latest-version") do={
diff --git a/email-backup b/email-backup
index 9761206..45e7703 100644
--- a/email-backup
+++ b/email-backup
@@ -18,7 +18,7 @@
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
- $LogAndError ("Configured to send neither backup nor config export.");
+ $LogAndError error ("Configured to send neither backup nor config export.");
}
# filename based on identity
diff --git a/global-functions b/global-functions
index 335df62..0e3b5f1 100644
--- a/global-functions
+++ b/global-functions
@@ -492,8 +492,9 @@
# log and error with same text
:set LogAndError do={
- :local Message [ :tostr $1 ];
+ :local Severity [ :tostr $1 ];
+ :local Message [ :tostr $2 ];
- :log warn $Message;
- :error $Message;
+ [ :parse (":log " . $Severity . " \$Message") ];
+ :error ($Severity . ": " . $Message);
}
diff --git a/ipv6-update b/ipv6-update
index 52c02db..eee3536 100644
--- a/ipv6-update
+++ b/ipv6-update
@@ -10,7 +10,7 @@
:global LogAndError;
:if ([ :typeof $PdPrefix ] = "nothing") do={
- $LogAndError "This script is supposed to run from ipv6 dhcp-client.";
+ $LogAndError error "This script is supposed to run from ipv6 dhcp-client.";
}
:local Pool [ / ipv6 pool get [ find where prefix=$PdPrefix ] name ];
diff --git a/lease-script b/lease-script
index 588c9ff..9109ea9 100644
--- a/lease-script
+++ b/lease-script
@@ -10,7 +10,7 @@
[ :typeof $leaseActMAC ] = "nothing" || \
[ :typeof $leaseServerName ] = "nothing" || \
[ :typeof $leaseBound ] = "nothing") do={
- $LogAndError "This script is supposed to run from ip dhcp-client.";
+ $LogAndError error "This script is supposed to run from ip dhcp-client.";
}
:local Scripts;
diff --git a/packages-update b/packages-update
index 04a25c8..b4233c8 100644
--- a/packages-update
+++ b/packages-update
@@ -26,7 +26,7 @@ $ScriptLock "packages-update";
:foreach Package in=[ / system package find where !bundle ] do={
:local PkgName [ / system package get $Package name ];
if ([ $DownloadPackage $PkgName ($Update->"latest-version") ] = false) do={
- $LogAndError ("Download for package " . $PkgName . " failed.");
+ $LogAndError error ("Download for package " . $PkgName . " failed.");
}
}
diff --git a/ppp-on-up b/ppp-on-up
index 6c72a94..415663c 100644
--- a/ppp-on-up
+++ b/ppp-on-up
@@ -9,7 +9,7 @@
:local Interface $interface;
:if ([ :typeof $Interface ] = "nothing") do={
- $LogAndError "This script is supposed to run from ppp on-up script hook.";
+ $LogAndError error "This script is supposed to run from ppp on-up script hook.";
}
:local IntName [ / interface get $Interface name ];
diff --git a/sms-action b/sms-action
index 5eabdd5..ceb9071 100644
--- a/sms-action
+++ b/sms-action
@@ -11,7 +11,7 @@
:local Action $action;
:if ([ :typeof $Action ] = "nothing") do={
- $LogAndError "This script is supposed to run from SMS hook with action=...";
+ $LogAndError error "This script is supposed to run from SMS hook with action=...";
}
:local Code ($SmsAction->$Action);
diff --git a/sms-forward b/sms-forward
index 8907d19..f03ab27 100644
--- a/sms-forward
+++ b/sms-forward
@@ -12,7 +12,7 @@
# check mail server
:if ($MailServerIsUp = false) do={
- $LogAndError "Mail server is not up.";
+ $LogAndError warning "Mail server is not up.";
}
:local Settings [ / tool sms get ];
diff --git a/update-tunnelbroker b/update-tunnelbroker
index 1dd11f1..138fac7 100644
--- a/update-tunnelbroker
+++ b/update-tunnelbroker
@@ -8,7 +8,7 @@
:global LogAndError;
:if ([ / ip cloud get ddns-enabled ] != true) do={
- $LogAndError "IP cloud DDNS is not enabled.";
+ $LogAndError error "IP cloud DDNS is not enabled.";
}
# Get the current ip address from cloud
diff --git a/upload-backup b/upload-backup
index a761007..817a088 100644
--- a/upload-backup
+++ b/upload-backup
@@ -20,7 +20,7 @@
:if ($BackupSendBinary != true && \
$BackupSendExport != true) do={
- $LogAndError ("Configured to send neither backup nor config export.");
+ $LogAndError error ("Configured to send neither backup nor config export.");
}
# filename based on identity