mirror of
https://github.com/nymurbd/MikroTik-scripts.git
synced 2025-08-18 00:28:29 +02: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
1 changed files with 23 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
||||||
:global IsMacLocallyAdministered;
|
:global IsMacLocallyAdministered;
|
||||||
:global IsTimeSync;
|
:global IsTimeSync;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
|
:global LogPrintOnce;
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
:global NotificationFunctions;
|
:global NotificationFunctions;
|
||||||
:global ParseDate;
|
: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
|
# create directory
|
||||||
:set MkDir do={
|
:set MkDir do={
|
||||||
:local Path [ :tostr $1 ];
|
:local Path [ :tostr $1 ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue