We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
None
Win
v3.4
[11-17 22:03:24.741] app.py (170) - [INFO] : 🤯 WebUI 仍处于 Beta 测试阶段,如有问题或建议请反馈到 https://github.com/RockChinQ/LangBot/issues --- Logging error --- Traceback (most recent call last): File "C:\Python310\lib\logging\__init__.py", line 1103, in emit stream.write(msg + self.terminator) UnicodeEncodeError: 'gbk' codec can't encode character '\U0001f92f' in position 50: illegal multibyte sequence Call stack: File "F:\langbot-v3.4.0-all\main.py", line 83, in <module> loop.run_until_complete(main_entry(loop)) File "C:\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Python310\lib\asyncio\base_events.py", line 1906, in _run_once handle._run() File "C:\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "F:\langbot-v3.4.0-all\main.py", line 53, in main_entry await boot.main(loop) File "F:\langbot-v3.4.0-all\pkg\core\boot.py", line 67, in main await app_inst.run() File "F:\langbot-v3.4.0-all\pkg\core\app.py", line 131, in run await self.print_web_access_info() File "F:\langbot-v3.4.0-all\pkg\core\app.py", line 170, in print_web_access_info self.logger.info(line) Message: '🤯 WebUI 仍处于 Beta 测试阶段,如有问题或建议请反馈到 https://github.com/RockChinQ/LangBot/issues' Arguments: () [11-17 22:03:24.742] app.py (170) - [INFO] : =======================================
修改建议? 修改后的 pkg/core/bootutils/log.py
import logging import os import sys import time import colorlog from ...utils import constants log_colors_config = { "DEBUG": "green", # cyan white "INFO": "white", "WARNING": "yellow", "ERROR": "red", "CRITICAL": "cyan", } async def init_logging(extra_handlers: list[logging.Handler] = None) -> logging.Logger: # 删除所有现有的logger for handler in logging.root.handlers[:]: logging.root.removeHandler(handler) level = logging.INFO if constants.debug_mode: level = logging.DEBUG log_file_name = "data/logs/langbot-%s.log" % time.strftime( "%Y-%m-%d", time.localtime() ) qcg_logger = logging.getLogger("qcg") qcg_logger.setLevel(level) color_formatter = colorlog.ColoredFormatter( fmt="%(log_color)s[%(asctime)s.%(msecs)03d] %(filename)s (%(lineno)d) - [%(levelname)s] : %(message)s", datefmt="%m-%d %H:%M:%S", log_colors=log_colors_config, ) stream_handler = logging.StreamHandler(sys.stdout) stream_handler.setLevel(level) stream_handler.setFormatter(color_formatter) stream_handler.stream = open(sys.stdout.fileno(), mode='w', encoding='utf-8', buffering=1) log_handlers: list[logging.Handler] = [stream_handler, logging.FileHandler(log_file_name, encoding='utf-8')] log_handlers += extra_handlers if extra_handlers is not None else [] for handler in log_handlers: handler.setLevel(level) handler.setFormatter(color_formatter) qcg_logger.addHandler(handler) qcg_logger.debug("日志初始化完成,日志级别:%s" % level) logging.basicConfig( level=logging.CRITICAL, # 设置日志输出格式 format="[DEPR][%(asctime)s.%(msecs)03d] %(pathname)s (%(lineno)d) - [%(levelname)s] :\n%(message)s", # 日志输出的格式 # -8表示占位符,让输出左对齐,输出长度都为8位 datefmt="%Y-%m-%d %H:%M:%S", # 时间输出的格式 handlers=[logging.NullHandler()], ) return qcg_logger
No response
The text was updated successfully, but these errors were encountered:
你pr一下吧,我已经躺床上了。
Sorry, something went wrong.
我再看看别的,似乎消息适配器配置页有bug,默认情况下,这些点不动(包括其他的),不能修改内容
已修复。编辑消息平台适配器那里,要点击折叠面板右上角一个笔的按钮才能编辑。
No branches or pull requests
消息平台适配器
None
运行环境
Win
LangBot 版本
v3.4
异常情况
修改建议?
修改后的 pkg/core/bootutils/log.py
启用的插件
No response
The text was updated successfully, but these errors were encountered: