move event info logging from Updater into VbanCmd

odd logout logging

patch bump
This commit is contained in:
onyx-and-iris 2022-09-29 11:48:30 +01:00
parent 566bff3ced
commit 2048a807d1
4 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "vban-cmd"
version = "1.5.0"
version = "1.5.1"
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT"

View File

@ -2,13 +2,15 @@ import logging
class Event:
"""Keeps track of event subscriptions"""
logger = logging.getLogger("event.event")
def __init__(self, subs: dict):
self.subs = subs
def info(self, msg):
info = (f"{msg} events",)
def info(self, msg=None):
info = (f"{msg} events",) if msg else ()
if self.any():
info += (f"now listening for {', '.join(self.get())} events",)
else:

View File

@ -52,6 +52,7 @@ class VbanCmd(metaclass=ABCMeta):
def login(self):
"""Starts the subscriber and updater threads"""
self.running = True
self.event.info()
self.subscriber = Subscriber(self)
self.subscriber.start()
@ -163,6 +164,7 @@ class VbanCmd(metaclass=ABCMeta):
self.running = False
time.sleep(0.2)
[sock.close() for sock in self.socks]
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
def __exit__(self, exc_type, exc_value, exc_traceback):
self.logout()

View File

@ -101,7 +101,6 @@ class Updater(threading.Thread):
return fget()
def update(self):
self.logger.info(f"Listening for {', '.join(self._remote.event.get())} events")
(
self._remote.cache["strip_level"],
self._remote.cache["bus_level"],