aboutsummaryrefslogtreecommitdiffstats
path: root/mode-button
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-02-22 15:14:10 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-02-24 21:51:54 +0100
commitf46db918453dcb8878b9a0de6e122fb0ea2224d9 (patch)
tree31544a450651d0705ecdea0c3d35e650ef784d67 /mode-button
parentb0e52aa2d1baa78fc9d025c0671fea8babba0ec2 (diff)
global: give script or function name in log messages
Diffstat (limited to 'mode-button')
-rw-r--r--mode-button13
1 files changed, 7 insertions, 6 deletions
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 ];
}