From f46db918453dcb8878b9a0de6e122fb0ea2224d9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 22 Feb 2021 15:14:10 +0100 Subject: global: give script or function name in log messages --- mode-button | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mode-button') diff --git a/mode-button b/mode-button index cd94919..8d96fcd 100644 --- a/mode-button +++ b/mode-button @@ -6,23 +6,24 @@ # act on multiple mode and reset button presses # https://git.eworm.de/cgit/routeros-scripts/about/doc/mode-button.md +:local 0 "mode-button"; :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :global ModeButton; -:global LogPrintExit; +:global LogPrintExit2; :set ($ModeButton->"count") ($ModeButton->"count" + 1); :local Scheduler [ / system scheduler find where name="ModeButtonScheduler" ]; :if ([ :len $Scheduler ] = 0) do={ - $LogPrintExit info ("Creating scheduler ModeButtonScheduler, counting presses...") false; + $LogPrintExit2 info $0 ("Creating scheduler ModeButtonScheduler, counting presses...") false; :global ModeButtonScheduler do={ :global ModeButton; - :global LogPrintExit; + :global LogPrintExit2; :global ModeButtonScheduler; :local LEDInvert do={ @@ -45,7 +46,7 @@ / system scheduler remove ModeButtonScheduler; :if ([ :len $Code ] > 0) do={ - $LogPrintExit info ("Acting on " . $Count . " mode-button presses: " . $Code) false; + $LogPrintExit2 info $0 ("Acting on " . $Count . " mode-button presses: " . $Code) false; :for I from=1 to=$Count do={ $LEDInvert; @@ -59,12 +60,12 @@ [ :parse $Code ]; } else={ - $LogPrintExit info ("No action defined for " . $Count . " mode-button presses.") false; + $LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false; } } / system scheduler add name="ModeButtonScheduler" \ on-event=":global ModeButtonScheduler; \$ModeButtonScheduler;" interval=3s; } else={ - $LogPrintExit debug ("Updating scheduler ModeButtonScheduler...") false; + $LogPrintExit2 debug $0 ("Updating scheduler ModeButtonScheduler...") false; / system scheduler set $Scheduler start-time=[ /system clock get time ]; } -- cgit v1.2.3-70-g09d2