🎨 忽略除本项目外的其它日志

This commit is contained in:
Karako 2022-09-10 23:43:49 +08:00
parent a524a869d3
commit 7cbe83df36
No known key found for this signature in database
GPG Key ID: 5920831B0095D4A0
2 changed files with 7 additions and 3 deletions

View File

@ -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:

View File

@ -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)