mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $LogAndError: add severity
This commit is contained in:
parent
6ef764c7d7
commit
3ebf68a08c
12 changed files with 16 additions and 15 deletions
|
@ -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={
|
||||
|
|
|
@ -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={
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue