From f42d578765f83021618edda292c451f75d537a43 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 7 Jul 2021 14:08:44 +0800 Subject: [PATCH] :bug: fix log tag unescaped --- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py | 4 ++-- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py index 009efb1d..da3ea47f 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py @@ -9,8 +9,8 @@ import httpx from nonebot.log import logger from nonebot.typing import overrides from nonebot.message import handle_event -from nonebot.utils import DataclassEncoder from nonebot.adapters import Bot as BaseBot +from nonebot.utils import escape_tag, DataclassEncoder from nonebot.drivers import Driver, HTTPConnection, HTTPRequest, HTTPResponse, WebSocket from .utils import log, escape @@ -321,7 +321,7 @@ class Bot(BaseBot): await handle_event(self, event) except Exception as e: logger.opt(colors=True, exception=e).error( - f"Failed to handle event. Raw: {data}" + f"Failed to handle event. Raw: {escape_tag(data)}" ) @overrides(BaseBot) diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py index e5ba6f36..3fd6ec11 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py @@ -37,7 +37,7 @@ class Event(BaseEvent): @overrides(BaseEvent) def get_event_description(self) -> str: - return str(self.dict()) + return escape_tag(str(self.dict())) @overrides(BaseEvent) def get_message(self) -> Message: