mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: introduce $LogPrintOnce
This does work just like $LogPrintExit2, except it acts just *once* for each message, until device is rebooted.
This commit is contained in:
parent
dce779250c
commit
72b4851255
|
@ -45,6 +45,7 @@
|
|||
:global IsMacLocallyAdministered;
|
||||
:global IsTimeSync;
|
||||
:global LogPrintExit2;
|
||||
:global LogPrintOnce;
|
||||
:global MkDir;
|
||||
:global NotificationFunctions;
|
||||
:global ParseDate;
|
||||
|
@ -613,6 +614,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
# log and print, once until reboot
|
||||
:set LogPrintOnce do={
|
||||
:local Severity [ :tostr $1 ];
|
||||
:local Name [ :tostr $2 ];
|
||||
:local Message [ :tostr $3 ];
|
||||
|
||||
:global LogPrintExit2;
|
||||
|
||||
:global LogPrintOnceMessages;
|
||||
|
||||
:if ([ :typeof $LogPrintOnceMessages ] = "nothing") do={
|
||||
:set LogPrintOnceMessages ({});
|
||||
}
|
||||
|
||||
:if ($LogPrintOnceMessages->$Message = 1) do={
|
||||
:return true;
|
||||
}
|
||||
|
||||
:set ($LogPrintOnceMessages->$Message) 1;
|
||||
$LogPrintExit2 $Severity $Name $Message false;
|
||||
}
|
||||
|
||||
# create directory
|
||||
:set MkDir do={
|
||||
:local Path [ :tostr $1 ];
|
||||
|
|
Loading…
Reference in a new issue