mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 06:56:39 +00:00 
			
		
		
		
	🔊 add log for event handle
This commit is contained in:
		| @@ -205,7 +205,8 @@ async def handle_event(bot: "Bot", event: "Event"): | |||||||
|     coros = list(map(lambda x: x(bot, event, state), _event_preprocessors)) |     coros = list(map(lambda x: x(bot, event, state), _event_preprocessors)) | ||||||
|     if coros: |     if coros: | ||||||
|         try: |         try: | ||||||
|             logger.debug("Running PreProcessors...") |             if show_log: | ||||||
|  |                 logger.debug("Running PreProcessors...") | ||||||
|             await asyncio.gather(*coros) |             await asyncio.gather(*coros) | ||||||
|         except IgnoredException: |         except IgnoredException: | ||||||
|             logger.opt(colors=True).info( |             logger.opt(colors=True).info( | ||||||
| @@ -240,11 +241,16 @@ async def handle_event(bot: "Bot", event: "Event"): | |||||||
|                 if not break_flag: |                 if not break_flag: | ||||||
|                     break_flag = True |                     break_flag = True | ||||||
|                     logger.debug("Stop event propagation") |                     logger.debug("Stop event propagation") | ||||||
|  |             elif isinstance(result, Exception): | ||||||
|  |                 logger.opt(colors=True, exception=result).error( | ||||||
|  |                     "<r><bg #f8bbd0>Error when checking Matcher.</bg #f8bbd0></r>" | ||||||
|  |                 ) | ||||||
|  |  | ||||||
|     coros = list(map(lambda x: x(bot, event, state), _event_postprocessors)) |     coros = list(map(lambda x: x(bot, event, state), _event_postprocessors)) | ||||||
|     if coros: |     if coros: | ||||||
|         try: |         try: | ||||||
|             logger.debug("Running PostProcessors...") |             if show_log: | ||||||
|  |                 logger.debug("Running PostProcessors...") | ||||||
|             await asyncio.gather(*coros) |             await asyncio.gather(*coros) | ||||||
|         except Exception as e: |         except Exception as e: | ||||||
|             logger.opt(colors=True, exception=e).error( |             logger.opt(colors=True, exception=e).error( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user