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 --- check-health | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'check-health') diff --git a/check-health b/check-health index 8cb2cf3..761a72f 100644 --- a/check-health +++ b/check-health @@ -6,6 +6,7 @@ # check for RouterOS health state # https://git.eworm.de/cgit/routeros-scripts/about/doc/check-health.md +:local 0 "check-health"; :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } @@ -16,7 +17,7 @@ :global CheckHealthVoltagePercent; :global Identity; -:global LogPrintExit; +:global LogPrintExit2; :global SendNotification; :global SymbolForNotification; @@ -28,7 +29,7 @@ :local CheckHealthCurrent [ / system health get ]; :if ([ :len $CheckHealthCurrent ] = 0) do={ - $LogPrintExit error ("Your device does not provide any health values.") true; + $LogPrintExit2 error $0 ("Your device does not provide any health values.") true; } :if ([ :typeof $CheckHealthTemperatureNotified ] != "array") do={ @@ -70,7 +71,7 @@ :if ($Name ~ "temperature" && \ [ :typeof $Temperature ] = "num") do={ :if ([ :typeof ($CheckHealthTemperature->$Name) ] != "num" ) do={ - $LogPrintExit info ("No threshold given for " . $Name . ", assuming 50C.") false; + $LogPrintExit2 info $0 ("No threshold given for " . $Name . ", assuming 50C.") false; :set ($CheckHealthTemperature->$Name) 50; } :local Validate [ / system health get $Name ]; -- cgit v1.2.3-54-g00ecf