diff --git a/wechatbot_client/wechat/adapter.py b/wechatbot_client/wechat/adapter.py index f27afc2..6542acf 100644 --- a/wechatbot_client/wechat/adapter.py +++ b/wechatbot_client/wechat/adapter.py @@ -317,12 +317,12 @@ def json_to_action(cls, json_data: Any) -> Optional[ActionRequest]: try: action = ActionRequest.parse_obj(json_data) except ValidationError: - log("ERROR", f"action请求错误: {json_data}") + log("ERROR", f"action请求错误: {escape_tag(format(json_data))}") return None logstring = str(action.dict()) if len(logstring) > 200: logstring = logstring[:200] + "..." - log("SUCCESS", f"收到action请求: {logstring}") + log("SUCCESS", f"收到action请求: {escape_tag(logstring)}") return action @classmethod diff --git a/wechatbot_client/wechat/wechat.py b/wechatbot_client/wechat/wechat.py index 4589ab5..a2f1e1f 100644 --- a/wechatbot_client/wechat/wechat.py +++ b/wechatbot_client/wechat/wechat.py @@ -24,7 +24,7 @@ StatusUpdateEvent, ) from wechatbot_client.typing import overrides -from wechatbot_client.utils import logger_wrapper +from wechatbot_client.utils import logger_wrapper, escape_tag from .adapter import Adapter @@ -167,5 +167,5 @@ async def handle_evnt_msg(self, msg: Message) -> None: if event is None: log("DEBUG", "未生成合适事件") return - log("SUCCESS", f"生成事件[{event.__repr_name__()}]:{event.dict()}") + log("SUCCESS", f"生成事件[{event.__repr_name__()}]:{escape_tag(format(event.dict()))}") await self.handle_event(event)