mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
🐛 fix log escape in mirai adapter
This commit is contained in:
parent
c268e0105d
commit
ad8429e7fa
@ -20,23 +20,29 @@ _AnyCallable = TypeVar("_AnyCallable", bound=Callable)
|
|||||||
|
|
||||||
|
|
||||||
class Log:
|
class Log:
|
||||||
_log = logger_wrapper('MIRAI')
|
|
||||||
|
@staticmethod
|
||||||
|
def _log(level: str, message: Any, exception: Optional[Exception] = None):
|
||||||
|
logger = logger_wrapper('MIRAI')
|
||||||
|
logger(level=level,
|
||||||
|
message=escape_tag(str(message)),
|
||||||
|
exception=exception)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def info(cls, message: Any):
|
def info(cls, message: Any):
|
||||||
cls._log('INFO', str(message))
|
cls._log('INFO', escape_tag(str(message)))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def debug(cls, message: Any):
|
def debug(cls, message: Any):
|
||||||
cls._log('DEBUG', str(message))
|
cls._log('DEBUG', escape_tag(str(message)))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def warn(cls, message: Any):
|
def warn(cls, message: Any):
|
||||||
cls._log('WARNING', str(message))
|
cls._log('WARNING', escape_tag(str(message)))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def error(cls, message: Any, exception: Optional[Exception] = None):
|
def error(cls, message: Any, exception: Optional[Exception] = None):
|
||||||
cls._log('ERROR', str(message), exception=exception)
|
cls._log('ERROR', escape_tag(str(message)), exception=exception)
|
||||||
|
|
||||||
|
|
||||||
class ActionFailed(exception.ActionFailed):
|
class ActionFailed(exception.ActionFailed):
|
||||||
|
Loading…
Reference in New Issue
Block a user