add sub logger to each addon
This commit is contained in:
parent
b73a352484
commit
4e4bb50e4a
1 changed files with 3 additions and 0 deletions
|
@ -55,6 +55,8 @@ class ConfigObject:
|
||||||
class Addon:
|
class Addon:
|
||||||
name: str
|
name: str
|
||||||
config: ConfigObject
|
config: ConfigObject
|
||||||
|
logger: logging.Logger
|
||||||
|
|
||||||
_client: 'Treepuncher'
|
_client: 'Treepuncher'
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
@ -86,6 +88,7 @@ class Addon:
|
||||||
else: # not really necessary since it's a dataclass but whatever
|
else: # not really necessary since it's a dataclass but whatever
|
||||||
opts[field.name] = default
|
opts[field.name] = default
|
||||||
self.config = self.Options(**opts)
|
self.config = self.Options(**opts)
|
||||||
|
self.logger = self._client.logger.getChild(self.name)
|
||||||
self.register()
|
self.register()
|
||||||
|
|
||||||
def register(self):
|
def register(self):
|
||||||
|
|
Loading…
Reference in a new issue