From 56f1e6adf8a0d491cc77813f7ac874635ffce402 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Fri, 18 Oct 2024 08:00:27 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20docs=20+=20guess=5Ficon=20loggin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/DEBUG_PLUGINS.md | 13 +++++++++++++ docs/DEBUG_TIPS.md | 11 +++++++++++ server/device.py | 9 ++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/DEBUG_PLUGINS.md b/docs/DEBUG_PLUGINS.md index 27ca3865..c59d2571 100755 --- a/docs/DEBUG_PLUGINS.md +++ b/docs/DEBUG_PLUGINS.md @@ -76,3 +76,16 @@ In the above output notice the section logging how many events are produced by t These values, if formatted correctly, will also show up in the UI: ![Plugins table](/docs/img/DEBUG_PLUGINS/plugin_objects_pihole.png) + + +### Sharing application state + +Sometimes specific log sections are needed to debug issues. The Devices and CurrentScan table data is sometimes needed to figure out what's wrong. + +1. Please set `LOG_LEVEL` to `trace` (Disable it once you have the info as this produces big log files). +2. Wait for the issue to occur. +3. Search for `================ DEVICES table content ================` in your logs. +4. Search for `================ CurrentScan table content ================` in your logs. +5. Open a new issue and post (redacted) output into the issue description (or send to the netalertx@gmail.com email if sensitive data present). +6. Please set `LOG_LEVEL` to `debug` or lower. + diff --git a/docs/DEBUG_TIPS.md b/docs/DEBUG_TIPS.md index 20cc8f0e..9e67ccf9 100755 --- a/docs/DEBUG_TIPS.md +++ b/docs/DEBUG_TIPS.md @@ -49,6 +49,17 @@ services: # Other service configurations... ``` +## 5. Sharing application state + +Sometimes specific log sections are needed to debug issues. The Devices and CurrentScan table data is sometimes needed to figure out what's wrong. + +1. Please set `LOG_LEVEL` to `trace` (Disable it once you have the info as this produces big log files). +2. Wait for the issue to occur. +3. Search for `================ DEVICES table content ================` in your logs. +4. Search for `================ CurrentScan table content ================` in your logs. +5. Open a new issue and post (redacted) output into the issue description (or send to the netalertx@gmail.com email if sensitive data present). +6. Please set `LOG_LEVEL` to `debug` or lower. + ## 📃Common issues ### Permissions diff --git a/server/device.py b/server/device.py index d85bdd6c..dbf2fb1a 100755 --- a/server/device.py +++ b/server/device.py @@ -459,7 +459,7 @@ def update_devices_data_from_scan (db): default_icon = get_setting_value('NEWDEV_dev_Icon') for device in sql.execute (query) : - # Conditional logic for dev_Icon guessing + # Conditional logic for dev_Icon guessing dev_Icon = guess_icon(device['dev_Vendor'], device['dev_MAC'], device['dev_LastIP'], device['dev_Name'], default_icon) recordsToUpdate.append ([dev_Icon, device['dev_MAC']]) @@ -677,7 +677,10 @@ icons = { #------------------------------------------------------------------------------- # Guess device icon -def guess_icon(vendor, mac, ip, name, default): +def guess_icon(vendor, mac, ip, name, default): + + mylog('debug', [f"[guess_icon] Guessing icon for (vendor|mac|ip|name): ('{vendor}'|'{mac}'|{ip}|{name})"]) + result = default mac = mac.upper() vendor = vendor.lower() if vendor else "unknown" @@ -706,7 +709,7 @@ def guess_icon(vendor, mac, ip, name, default): result = icons.get("microchip") # Guess icon based on MAC address patterns - elif mac == "INTERNET": # Apple + elif mac == "INTERNET": result = icons.get("globe") elif mac.startswith("00:1A:79"): # Apple result = icons.get("apple")