From 06f20281a5c111493e361060e82da9510378a935 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Thu, 29 Oct 2020 17:06:07 +0800 Subject: [PATCH] :mute: remove meta event logs #21 --- nonebot/message.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nonebot/message.py b/nonebot/message.py index 4d64c25d..d9e61c63 100644 --- a/nonebot/message.py +++ b/nonebot/message.py @@ -54,6 +54,7 @@ async def _run_matcher(Matcher: Type[Matcher], bot: Bot, event: Event, async def handle_event(bot: Bot, event: Event): + show_log = True log_msg = f"{bot.type.upper()} | {event.self_id} [{event.name}]: " if event.type == "message": log_msg += f"Message {event.id} from " @@ -71,8 +72,10 @@ async def handle_event(bot: Bot, event: Event): elif event.type == "request": log_msg += f"Request {event.raw_event}" elif event.type == "meta_event": - log_msg += f"MetaEvent {event.detail_type}" - logger.opt(colors=True).info(log_msg) + # log_msg += f"MetaEvent {event.detail_type}" + show_log = False + if show_log: + logger.opt(colors=True).info(log_msg) coros = [] state = {} @@ -100,7 +103,8 @@ async def handle_event(bot: Bot, event: Event): for matcher in matchers[priority] ] - logger.debug(f"Checking for matchers in priority {priority}...") + if show_log: + logger.debug(f"Checking for matchers in priority {priority}...") results = await asyncio.gather(*pending_tasks, return_exceptions=True) i = 0