更换print到logger
This commit is contained in:
@@ -9,6 +9,7 @@ import pkgutil
|
||||
import sys
|
||||
|
||||
from core.command_manager import matcher
|
||||
from .logger import logger
|
||||
|
||||
|
||||
def load_all_plugins():
|
||||
@@ -24,7 +25,7 @@ def load_all_plugins():
|
||||
plugin_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "plugins")
|
||||
package_name = "plugins"
|
||||
|
||||
print(f" 正在从 {package_name} 加载插件...")
|
||||
logger.info(f"正在从 {package_name} 加载插件...")
|
||||
|
||||
for loader, module_name, is_pkg in pkgutil.iter_modules([plugin_dir]):
|
||||
full_module_name = f"{package_name}.{module_name}"
|
||||
@@ -43,6 +44,6 @@ def load_all_plugins():
|
||||
matcher.plugins[full_module_name] = meta
|
||||
|
||||
type_str = "包" if is_pkg else "文件"
|
||||
print(f" [{type_str}] 成功{action}: {module_name}")
|
||||
logger.success(f" [{type_str}] 成功{action}: {module_name}")
|
||||
except Exception as e:
|
||||
print(f" {action if 'action' in locals() else '加载'}插件 {module_name} 失败: {e}")
|
||||
logger.error(f" {action if 'action' in locals() else '加载'}插件 {module_name} 失败: {e}")
|
||||
|
||||
Reference in New Issue
Block a user