add sub logger to each addon

This commit is contained in:
əlemi 2022-04-25 04:43:00 +02:00
parent b73a352484
commit 4e4bb50e4a
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -55,6 +55,8 @@ class ConfigObject:
class Addon:
name: str
config: ConfigObject
logger: logging.Logger
_client: 'Treepuncher'
@dataclass(frozen=True)
@ -86,6 +88,7 @@ class Addon:
else: # not really necessary since it's a dataclass but whatever
opts[field.name] = default
self.config = self.Options(**opts)
self.logger = self._client.logger.getChild(self.name)
self.register()
def register(self):