Improve logging
All checks were successful
docker-image / docker (push) Successful in 9m49s

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

View file

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

View file

@ -15,7 +15,7 @@ class BubaCmd:
self.display = None self.display = None
if not path.exists(serial): if not path.exists(serial):
self.serial = None 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: if self.serial is not None:
self.display = MIS1TextDisplay(serial) self.display = MIS1TextDisplay(serial)
self.send = send self.send = send

View file

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