Improve logging

This commit is contained in:
Stefan Bethke 2025-06-01 19:06:50 +02:00
commit fccc727c42
3 changed files with 5 additions and 2 deletions

View file

@ -14,6 +14,8 @@ class BubaAnimation:
def run(self):
pass
def __repr__(self):
return f"<{type(self).__name__}>"
class BubaTime(BubaAnimation):
def __init__(self, buba: BubaCmd):

View file

@ -15,7 +15,7 @@ class BubaCmd:
self.display = None
if not path.exists(serial):
self.serial = None
logging.warning(f"Unable to find serial port '{serial}', ignoring")
self.log.warning(f"Unable to find serial port '{serial}', ignoring")
if self.serial is not None:
self.display = MIS1TextDisplay(serial)
self.send = send

View file

@ -13,6 +13,7 @@ from buba.websocketcomm import WebSocketClients
config = AppConfig()
if config.debug:
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
app = Bottle()
if config.debug:
@ -48,7 +49,7 @@ def websocket_endpoint(ws: WebSocket):
while True:
m = ws.receive()
except Exception as e:
logging.debug("error in websocket", exc_info=e)
log.debug("error in websocket", exc_info=e)
pass
finally:
websocket_clients.remove(ws)