move @thebentern spiffy logging so it is shared with !ble log sources

This commit is contained in:
Kevin Hester
2024-06-29 16:15:32 -07:00
parent 42236f2de8
commit 1da687cf2d
2 changed files with 17 additions and 13 deletions

View File

@@ -8,7 +8,6 @@ import time
from threading import Thread
from typing import Optional
import print_color # type: ignore[import-untyped]
from bleak import BleakClient, BleakScanner, BLEDevice
from bleak.exc import BleakDBusError, BleakError
@@ -82,16 +81,7 @@ class BLEInterface(MeshInterface):
async def log_radio_handler(self, _, b): # pylint: disable=C0116
log_radio = b.decode("utf-8").replace("\n", "")
if log_radio.startswith("DEBUG"):
print_color.print(log_radio, color="cyan", end=None)
elif log_radio.startswith("INFO"):
print_color.print(log_radio, color="white", end=None)
elif log_radio.startswith("WARN"):
print_color.print(log_radio, color="yellow", end=None)
elif log_radio.startswith("ERROR"):
print_color.print(log_radio, color="red", end=None)
else:
print_color.print(log_radio, end=None)
self._handleLogLine(log_radio)
@staticmethod
def scan() -> list[BLEDevice]: