From 60a93766c7b99b71e518a5da649ae8327f386183 Mon Sep 17 00:00:00 2001 From: Pliosauroidea Date: Tue, 11 Mar 2025 18:42:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0logger=E7=9A=84debug=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E5=BC=80=E5=85=B3,=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E4=B8=8D=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/config.py | 9 ++++++++- template/bot_config_template.toml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/chat/config.py b/src/plugins/chat/config.py index 7aed9eee8..596d120f9 100644 --- a/src/plugins/chat/config.py +++ b/src/plugins/chat/config.py @@ -1,4 +1,5 @@ import os +import sys from dataclasses import dataclass, field from typing import Dict, List, Optional @@ -67,6 +68,7 @@ class BotConfig: enable_advance_output: bool = False # 是否启用高级输出 enable_kuuki_read: bool = True # 是否启用读空气功能 + enable_debug_output: bool = False # 是否启用调试输出 mood_update_interval: float = 1.0 # 情绪更新间隔 单位秒 mood_decay_rate: float = 0.95 # 情绪衰减率 @@ -325,6 +327,7 @@ class BotConfig: others_config = parent["others"] config.enable_advance_output = others_config.get("enable_advance_output", config.enable_advance_output) config.enable_kuuki_read = others_config.get("enable_kuuki_read", config.enable_kuuki_read) + config.enable_debug_output = others_config.get("enable_debug_output", config.enable_debug_output) # 版本表达式:>=1.0.0,<2.0.0 # 允许字段:func: method, support: str, notice: str, necessary: bool @@ -419,4 +422,8 @@ global_config = BotConfig.load_config(config_path=bot_config_path) if not global_config.enable_advance_output: logger.remove() - pass + +# 调试输出功能 +if global_config.enable_debug_output: + logger.remove() + logger.add(sys.stdout, level="DEBUG") diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 126fc501d..bea6ab7b7 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -100,6 +100,7 @@ word_replace_rate=0.006 # 整词替换概率 [others] enable_advance_output = true # 是否启用高级输出 enable_kuuki_read = true # 是否启用读空气功能 +enable_debug_output = false # 是否启用调试输出 [groups] talk_allowed = [