diff --git a/README.md b/README.md index fc174cd..b048689 100644 --- a/README.md +++ b/README.md @@ -258,10 +258,10 @@ pyMC Repeater can run inside a Proxmox LXC container using a **CH341 USB-to-SPI Run this on the **Proxmox host** (not inside a container): ```bash -bash -c "$(curl -fsSL https://raw.githubusercontent.com/rightup/pyMC_Repeater/feat/newRadios/scripts/proxmox-install.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/rightup/pyMC_Repeater/dev/scripts/proxmox-install.sh)" ``` -> **Tip:** Replace `feat/newRadios` in the URL with whichever branch you want to install. +> **Tip:** Replace `dev` in the URL with whichever branch you want to install. The installer will interactively prompt you for container settings (hostname, RAM, disk, bridge, etc.) and then: diff --git a/repeater/data_acquisition/mqtt_handler.py b/repeater/data_acquisition/mqtt_handler.py index dda3fef..8164611 100644 --- a/repeater/data_acquisition/mqtt_handler.py +++ b/repeater/data_acquisition/mqtt_handler.py @@ -31,6 +31,16 @@ except ImportError: logger = logging.getLogger("MQTTHandler") +# Custom ultra-verbose level for high-frequency per-broker publish logs. +# Keeps default DEBUG useful while allowing deep diagnostics when needed. +TRACE_LEVEL = 5 +logging.addLevelName(TRACE_LEVEL, "TRACE") + + +def _trace(message: str): + if logger.isEnabledFor(TRACE_LEVEL): + logger.log(TRACE_LEVEL, message) + # -------------------------------------------------------------------- # Helper: Base64URL without padding @@ -513,7 +523,7 @@ class _BrokerConnection: qos = 1 if self.retain_status else 0 full_topic = f"{self.base_topic}/{subtopic}" - logger.debug( + _trace( f"Publishing topic='{_truncate_middle(full_topic)}', bytes={len(payload.encode('utf-8'))}, " f"running={self._running}, retain={retain}, qos={qos}" ) @@ -560,7 +570,7 @@ class _BrokerConnection: refresh_threshold = 0.80 + stagger_offset refresh_delay = expiry_seconds * refresh_threshold - logger.info( + _trace( f"JWT refresh scheduled for {self.broker['name']} in {refresh_delay:.0f}s " f"({refresh_threshold*100:.0f}% of {self.jwt_expiry_minutes}min token lifetime)" ) @@ -960,11 +970,11 @@ class MeshCoreToMqttPusher: for conn in self.connections: if conn.enabled and conn.is_connected(): if packet_type in conn.disallowed_types: - logger.debug(f"Skipped publishing packet type 0x{packet_type:02X} (disallowed)") + _trace(f"Skipped publishing packet type 0x{packet_type:02X} (disallowed)") continue result = conn.publish(subtopic, message, retain=retain, qos=qos) results.append((conn.broker["name"], result)) - logger.debug(f"Published to {conn.broker['name']} -- {subtopic}") + _trace(f"Published to {conn.broker['name']} -- {subtopic}") elif conn.enabled == False: results.append((conn.broker["name"], "Skipped due to being disabled")) @@ -993,7 +1003,7 @@ class MeshCoreToMqttPusher: if conn.enabled and conn.is_connected(): if conn.format != "mqtt": # Custom-MQTT-only path; MC2MQTT brokers are intentionally skipped here. - logger.debug( + _trace( f"Skipped publishing to {conn.broker['name']} " f"(intentional: publish_mqtt only targets legacy mqtt format; broker format={conn.format})" ) @@ -1001,7 +1011,7 @@ class MeshCoreToMqttPusher: continue result = conn.publish(subtopic, message, retain=retain, qos=qos) results.append((conn.broker["name"], result)) - logger.debug(f"Published to {conn.broker['name']} (format={conn.format}) -- {subtopic}") + _trace(f"Published to {conn.broker['name']} (format={conn.format}) -- {subtopic}") elif conn.enabled == False: results.append((conn.broker["name"], "Skipped due to being disabled")) diff --git a/scripts/proxmox-install.sh b/scripts/proxmox-install.sh index b9f0c2b..750a1de 100644 --- a/scripts/proxmox-install.sh +++ b/scripts/proxmox-install.sh @@ -12,7 +12,7 @@ set -euo pipefail # ── Defaults ─────────────────────────────────────────────────────────────── REPO="https://github.com/rightup/pyMC_Repeater.git" -BRANCH="feat/newRadios" +BRANCH="dev" CT_TEMPLATE="debian-12-standard" CT_RAM=1024 CT_SWAP=512