From 2c07f242ad510249191a67d2d25615dd2eba813c Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Thu, 22 Jun 2023 22:17:20 +0100 Subject: [PATCH] added module level loggers. class loggers implemented as child loggers. patch bump --- obsws_python/baseclient.py | 5 +++-- obsws_python/events.py | 4 +++- obsws_python/reqs.py | 5 +++-- obsws_python/version.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/obsws_python/baseclient.py b/obsws_python/baseclient.py index 4f47d4b..fedc517 100644 --- a/obsws_python/baseclient.py +++ b/obsws_python/baseclient.py @@ -11,11 +11,12 @@ from websocket import WebSocketTimeoutException from .error import OBSSDKError, OBSSDKTimeoutError +logger = logging.getLogger(__name__) + class ObsClient: - logger = logging.getLogger("baseclient.obsclient") - def __init__(self, **kwargs): + self.logger = logger.getChild(self.__class__.__name__) defaultkwargs = { "host": "localhost", "port": 4455, diff --git a/obsws_python/events.py b/obsws_python/events.py index a358fe7..8b6b604 100644 --- a/obsws_python/events.py +++ b/obsws_python/events.py @@ -16,12 +16,14 @@ defined in official github repo https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#events """ +logger = logging.getLogger(__name__) + class EventClient: - logger = logging.getLogger("events.eventclient") DELAY = 0.001 def __init__(self, **kwargs): + self.logger = logger.getChild(self.__class__.__name__) defaultkwargs = {"subs": Subs.LOW_VOLUME} kwargs = defaultkwargs | kwargs self.base_client = ObsClient(**kwargs) diff --git a/obsws_python/reqs.py b/obsws_python/reqs.py index fb7a809..4ff4544 100644 --- a/obsws_python/reqs.py +++ b/obsws_python/reqs.py @@ -10,11 +10,12 @@ defined in official github repo https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#Requests """ +logger = logging.getLogger(__name__) + class ReqClient: - logger = logging.getLogger("reqs.reqclient") - def __init__(self, **kwargs): + self.logger = logger.getChild(self.__class__.__name__) self.base_client = ObsClient(**kwargs) if self.base_client.authenticate(): self.logger.info(f"Successfully identified {self} with the server") diff --git a/obsws_python/version.py b/obsws_python/version.py index e3a0f01..0c46db4 100644 --- a/obsws_python/version.py +++ b/obsws_python/version.py @@ -1 +1 @@ -version = "1.5.0" +version = "1.5.1"