Improved logging

This commit is contained in:
Sven Heidemann 2021-11-15 21:54:06 +01:00
parent f2ee3d64f6
commit 647e847d17
2 changed files with 3 additions and 8 deletions

View File

@ -7,12 +7,9 @@ from modules_core.abc.module_service_abc import ModuleServiceABC
class BootLog(ModuleABC): class BootLog(ModuleABC):
def __init__(self, logger: LoggerABC, bot: BotServiceABC): def __init__(self, logger: LoggerABC):
self._logger = logger self._logger = logger
self._bot = bot
self._logger.info(__name__, 'LOADED')
ModuleABC.__init__(self) ModuleABC.__init__(self)
async def on_ready(self): async def on_ready(self):
self._logger.info(__name__, f'Bot started: {self._bot}') self._logger.info(__name__, f'Bot started')

View File

@ -23,9 +23,7 @@ class ModuleService(ModuleServiceABC):
self._modules.extend(ModuleABC.__subclasses__()) self._modules.extend(ModuleABC.__subclasses__())
async def start_modules(self): async def start_modules(self):
self._logger.info(__name__, self._modules) modules = self._modules.where(lambda m: hasattr(m, 'on_ready') and callable(m.on_ready))
modules = self._modules.where(lambda m: hasattr(m, 'on_ready'))
self._logger.info(__name__, f'HIER: {modules}')
for module_type in modules: for module_type in modules:
module = self._services.get_service(module_type) module = self._services.get_service(module_type)
await module.on_ready() await module.on_ready()