mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 17:15:05 +08:00
🐛 fix log tag unescaped
This commit is contained in:
parent
3571a5fdc0
commit
f42d578765
@ -9,8 +9,8 @@ import httpx
|
|||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
from nonebot.typing import overrides
|
from nonebot.typing import overrides
|
||||||
from nonebot.message import handle_event
|
from nonebot.message import handle_event
|
||||||
from nonebot.utils import DataclassEncoder
|
|
||||||
from nonebot.adapters import Bot as BaseBot
|
from nonebot.adapters import Bot as BaseBot
|
||||||
|
from nonebot.utils import escape_tag, DataclassEncoder
|
||||||
from nonebot.drivers import Driver, HTTPConnection, HTTPRequest, HTTPResponse, WebSocket
|
from nonebot.drivers import Driver, HTTPConnection, HTTPRequest, HTTPResponse, WebSocket
|
||||||
|
|
||||||
from .utils import log, escape
|
from .utils import log, escape
|
||||||
@ -321,7 +321,7 @@ class Bot(BaseBot):
|
|||||||
await handle_event(self, event)
|
await handle_event(self, event)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.opt(colors=True, exception=e).error(
|
logger.opt(colors=True, exception=e).error(
|
||||||
f"<r><bg #f8bbd0>Failed to handle event. Raw: {data}</bg #f8bbd0></r>"
|
f"<r><bg #f8bbd0>Failed to handle event. Raw: {escape_tag(data)}</bg #f8bbd0></r>"
|
||||||
)
|
)
|
||||||
|
|
||||||
@overrides(BaseBot)
|
@overrides(BaseBot)
|
||||||
|
@ -37,7 +37,7 @@ class Event(BaseEvent):
|
|||||||
|
|
||||||
@overrides(BaseEvent)
|
@overrides(BaseEvent)
|
||||||
def get_event_description(self) -> str:
|
def get_event_description(self) -> str:
|
||||||
return str(self.dict())
|
return escape_tag(str(self.dict()))
|
||||||
|
|
||||||
@overrides(BaseEvent)
|
@overrides(BaseEvent)
|
||||||
def get_message(self) -> Message:
|
def get_message(self) -> Message:
|
||||||
|
Loading…
Reference in New Issue
Block a user