diff --git a/core/bot.py b/core/bot.py index 97791dc..20a7b11 100644 --- a/core/bot.py +++ b/core/bot.py @@ -186,6 +186,7 @@ class Bot: await self.start_services() logger.info('开始安装插件') await self.install_plugins() + logger.info('BOT 初始化成功') def launch(self) -> NoReturn: """启动机器人""" @@ -199,7 +200,6 @@ class Bot: .post_init(self._post_init) .build() ) - logger.info('BOT 初始化成功') try: for _ in range(5): try: diff --git a/utils/log/_logger.py b/utils/log/_logger.py index c353ff4..ab58f60 100644 --- a/utils/log/_logger.py +++ b/utils/log/_logger.py @@ -463,12 +463,16 @@ with _lock: FileHandler(level=40, path=config.logger.path.joinpath("error/error.log")) ) + log_filter = logging.Filter('TGPaimon') + handler.addFilter(log_filter) + debug_handler.addFilter(log_filter) + level_ = 10 if config.debug else 20 logging.basicConfig( level=10 if config.debug else 20, format="%(message)s", - datefmt="[%Y-%m-%d %X]", - handlers=[handler, debug_handler, error_handler] + datefmt=config.logger.time_format, + handlers=[handler, debug_handler, error_handler], ) warnings_logger = logging.getLogger("py.warnings") warnings_logger.addHandler(handler)