From 5010c76ef724e133d9a25f3747502d70f0bfbd92 Mon Sep 17 00:00:00 2001 From: befantasy <31535803+befantasy@users.noreply.github.com> Date: Sat, 23 Sep 2023 13:37:01 +0800 Subject: [PATCH] =?UTF-8?q?Update=20godcmd.py=20=E5=A2=9E=E5=8A=A0debug?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=9A=84=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/godcmd/godcmd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/godcmd/godcmd.py b/plugins/godcmd/godcmd.py index c0be087..edab3f0 100644 --- a/plugins/godcmd/godcmd.py +++ b/plugins/godcmd/godcmd.py @@ -4,6 +4,7 @@ import json import os import random import string +import logging from typing import Tuple import plugins @@ -339,8 +340,12 @@ class Godcmd(Plugin): else: ok, result = False, "当前对话机器人不支持重置会话" elif cmd == "debug": - logger.setLevel("DEBUG") - ok, result = True, "DEBUG模式已开启" + if logger.getEffectiveLevel() == logging.DEBUG: # 判断当前日志模式是否DEBUG + logger.setLevel(logging.INFO) + ok, result = True, "DEBUG模式已关闭" + else: + logger.setLevel(logging.DEBUG) + ok, result = True, "DEBUG模式已开启" elif cmd == "plist": plugins = PluginManager().list_plugins() ok = True