feat(core): 新增日志管理功能
- 在配置文件中添加日志保存和保留天数设置项 - 实现日志保存功能,每次运行后保存日志到指定目录 - 添加日志分析功能,掉落信息并保存为 JSON 文件 - 在设置界面新增日志管理相关配置选项 todo: 日志清理可能有问题、多账号日志可能会保存为上一个账号的日志(加了time.sleep还没测)
This commit is contained in:
@@ -77,6 +77,7 @@ class Setting(QWidget):
|
||||
self.function = FunctionSettingCard(self)
|
||||
self.start = StartSettingCard(self)
|
||||
self.ui = UiSettingCard(self)
|
||||
self.log_settings = LogSettingCard(self)
|
||||
self.notification = NotifySettingCard(self)
|
||||
self.security = SecuritySettingCard(self)
|
||||
self.updater = UpdaterSettingCard(self)
|
||||
@@ -92,6 +93,7 @@ class Setting(QWidget):
|
||||
content_layout.addWidget(self.function)
|
||||
content_layout.addWidget(self.start)
|
||||
content_layout.addWidget(self.ui)
|
||||
content_layout.addWidget(self.log_settings)
|
||||
content_layout.addWidget(self.notification)
|
||||
content_layout.addWidget(self.security)
|
||||
content_layout.addWidget(self.updater)
|
||||
@@ -797,6 +799,35 @@ class OtherSettingCard(HeaderCardWidget):
|
||||
self.viewLayout.setSpacing(0)
|
||||
self.addGroupWidget(widget)
|
||||
|
||||
class LogSettingCard(HeaderCardWidget):
|
||||
"""日志管理设置"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setTitle("日志管理")
|
||||
|
||||
# 日志存储开关
|
||||
self.card_IfEnableLog = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="启用日志存储",
|
||||
content="记录并存储每次运行的日志,用于多账号日常掉落统计",
|
||||
configItem=Config.global_config.function_IfEnableLog,
|
||||
)
|
||||
|
||||
# 日志保留天数设置
|
||||
self.card_LogRetentionDays = ComboBoxSettingCard(
|
||||
configItem=Config.global_config.function_LogRetentionDays,
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="日志保留天数",
|
||||
content="选择日志的保留时间,超期自动清理",
|
||||
texts=["7 天", "15 天", "30 天", "60 天", "永不清理"],
|
||||
)
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
Layout.addWidget(self.card_IfEnableLog)
|
||||
Layout.addWidget(self.card_LogRetentionDays)
|
||||
self.viewLayout.addLayout(Layout)
|
||||
|
||||
|
||||
def version_text(version_numb: list) -> str:
|
||||
"""将版本号列表转为可读的文本信息"""
|
||||
|
||||
Reference in New Issue
Block a user