Files
NebulaShell/store/@{FutureOSS}/plugin-loader-pro/utils/logger.py
qwen.ai[bot] 97ced1b5e6 Title: Implement minimal core framework with PL injection and update build config
Key features implemented:
- Updated package metadata and dependencies in PKG-INFO, setup files
- Added main.py entry point for backward compatibility with README launch method
- Enhanced CLI with config options, system info command, and proper signal handling
- Implemented minimal PluginManager loading only plugin-loader core plugin
- Refactored PluginLoader to follow minimal core design, removed sandbox/isolation complexity
- Updated auto-dependency plugin with safer PL injection mechanism and disabled pl_injection
- Removed legacy plugin files (firewall, frp_proxy, ftp_server, multi_lang_deploy, ops_toolbox, security_gateway) as functionality moved to core plugin system
- Improved gitignore with comprehensive ignore patterns

The changes implement a minimal core framework design where only the plugin-loader is directly loaded by the core, with all other plugins managed through the PL injection mechanism, significantly simplifying the architecture.
2026-04-25 10:47:26 +00:00

61 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""插件加载 Pro - 日志工具"""
import sys
class ProLogger:
"""Pro 日志记录器 - 智能颜色识别"""
_COLORS = {
"reset": "\033[0m",
"white": "\033[0;37m",
"yellow": "\033[1;33m",
"blue": "\033[1;34m",
"red": "\033[1;31m",
}
@staticmethod
def _colorize(text: str, color: str) -> str:
"""添加颜色(终端支持时)"""
if not sys.stdout.isatty():
return text
return f"{ProLogger._COLORS.get(color, '')}{text}{ProLogger._COLORS['reset']}"
@staticmethod
def info(component: str, message: str):
"""正常日志 - 白色"""
tag = ProLogger._colorize(f"[pro:{component}]", "white")
msg = ProLogger._colorize(message, "white")
print(f"{tag} {msg}")
@staticmethod
def warn(component: str, message: str):
"""警告日志 - 黄色"""
tag = ProLogger._colorize(f"[pro:{component}]", "yellow")
icon = ProLogger._colorize("", "yellow")
msg = ProLogger._colorize(message, "yellow")
print(f"{tag} {icon} {msg}")
@staticmethod
def error(component: str, message: str):
"""错误日志 - 红色"""
tag = ProLogger._colorize(f"[pro:{component}]", "red")
icon = ProLogger._colorize("", "red")
msg = ProLogger._colorize(message, "red")
print(f"{tag} {icon} {msg}")
@staticmethod
def debug(component: str, message: str):
"""调试日志 - 蓝色"""
tag = ProLogger._colorize(f"[pro:{component}]", "blue")
icon = ProLogger._colorize("", "blue")
msg = ProLogger._colorize(message, "blue")
print(f"{tag} {icon} {msg}")
@staticmethod
def tip(component: str, message: str):
"""提示日志 - 蓝色(用于小提示/额外信息)"""
tag = ProLogger._colorize(f"[pro:{component}]", "blue")
icon = ProLogger._colorize("", "blue")
msg = ProLogger._colorize(message, "blue")
print(f"{tag} {icon} {msg}")