global: give script or function name in log messages
This commit is contained in:
parent
b0e52aa2d1
commit
f46db91845
46 changed files with 262 additions and 212 deletions
|
|
@ -8,13 +8,14 @@
|
|||
#
|
||||
# !! Do not edit this file, it is generated from template!
|
||||
|
||||
:local 0 "collect-wireless-mac.local";
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:global Identity;
|
||||
|
||||
:global GetMacVendor;
|
||||
:global LogPrintExit;
|
||||
:global LogPrintExit2;
|
||||
:global ScriptLock;
|
||||
:global SendNotification;
|
||||
:global SymbolForNotification;
|
||||
|
|
@ -23,7 +24,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
|
||||
:if ([ :len [ / interface wireless access-list find where comment="--- collected above ---" disabled ] ] = 0) do={
|
||||
/ interface wireless access-list add comment="--- collected above ---" disabled=yes;
|
||||
$LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false;
|
||||
$LogPrintExit2 warning $0 ("Added disabled access-list entry with comment '--- collected above ---'.") false;
|
||||
}
|
||||
:local PlaceBefore ([ / interface wireless access-list find where comment="--- collected above ---" disabled ]->0);
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
:local Vendor [ $GetMacVendor $Mac ];
|
||||
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
|
||||
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
|
||||
$LogPrintExit info $Message false;
|
||||
$LogPrintExit2 info $0 $Message false;
|
||||
/ interface wireless access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
|
||||
$SendNotification ([ $SymbolForNotification "mobile-phone" ] . $Mac . " connected to " . $Ssid) \
|
||||
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
|
||||
|
|
@ -67,7 +68,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
"DNS name: " . $DnsName . "\n" . \
|
||||
"Date: " . $DateTime);
|
||||
} else={
|
||||
$LogPrintExit debug ("MAC address " . $Mac . " already known: " . \
|
||||
$LogPrintExit2 debug $0 ("MAC address " . $Mac . " already known: " . \
|
||||
[ / interface wireless access-list get $AccessList comment ]) false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue