diff --git a/LittlePaimon/utils/logger.py b/LittlePaimon/utils/logger.py
index 4e287f9..f709396 100644
--- a/LittlePaimon/utils/logger.py
+++ b/LittlePaimon/utils/logger.py
@@ -1,6 +1,7 @@
from typing import Dict
from nonebot import logger as nb_logger
+from nonebot.utils import escape_tag
class logger:
@@ -10,20 +11,20 @@ class logger:
@staticmethod
def info(command: str, info: str = '', param: Dict[str, any] = None, result: str = '', result_type: bool = True):
- param_str = ' '.join([f'{k}{v}' for k, v in param.items()]) if param else ''
- result_str = f'{result}' if result_type else f'{result}' if result else ''
+ param_str = ' '.join([f'{k}{escape_tag(v)}' for k, v in param.items()]) if param else ''
+ result_str = f'{escape_tag(result)}' if result_type else f'{escape_tag(result)}' if result else ''
nb_logger.opt(colors=True).info(f'[{command}]{info}{param_str}{result_str}')
@staticmethod
def success(command: str, info: str = '', param: Dict[str, any] = None, result: str = ''):
- param_str = ' '.join([f'{k}{v}' for k, v in param.items()]) if param else ''
- result_str = f'{result}' if result else ''
+ param_str = ' '.join([f'{k}{escape_tag(v)}' for k, v in param.items()]) if param else ''
+ result_str = f'{escape_tag(result)}' if result else ''
nb_logger.opt(colors=True).success(f'[{command}]{info}{param_str}{result_str}')
@staticmethod
def warning(command: str, info: str = '', action: str = ''):
- nb_logger.opt(colors=True).warning(f'[{command}]{info}{action}')
+ nb_logger.opt(colors=True).warning(f'[{command}]{escape_tag(info)}{escape_tag(action)}')
@staticmethod
def debug(command: str, info: str):
- nb_logger.opt(colors=True).debug(f'[{command}]{info}')
+ nb_logger.opt(colors=True).debug(f'[{command}]{escape_tag(info)}')