Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions config/log_analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 各脚本日志位置与分析规则;运行链生成、日志分析和 GUI 日志跳转共用。
#
# 原先 hardcode 在 monitor.py 各 *LogParser 子类里的判定关键词(报错标记 / 良性噪声 /
# 每日完成标记 / 终止横幅标记(崩铁专用) / 体力提取正则 / 成功与失败判定词)统一集中
# 每日完成标记 / 终止横幅标记(崩铁专用) / 体力提取正则 / 失败判定词)统一集中
# 于此,便于在不改代码的情况下调整判定口径。新增游戏时:在下面 parsers 下加一个
# 以脚本唯一标识(与 config.yml script_path 推导的 get_script_name 一致)为键的条目即可。
#
Expand Down Expand Up @@ -38,11 +38,8 @@ parsers:
- 'waiting for game to start error'
- 'capture_by_bitblt invalid params'
daily_success_marker:
- 'claim daily reward via coordinate'
- 'current daily progress 180'
success_markers:
- 'Successfully Executed Task'
- 'Task completed'
- '每日任务已完成'

ok-nte:
log_path: 'data/apps/ok-nte/working/logs/ok-script.log'
Expand All @@ -55,9 +52,6 @@ parsers:
# 每日看日常领取是否完成;家具等其他子任务失败仍保留报错。
daily_success_marker:
- 'DailyRoutineTask:任务完成: 日常领取'
success_markers:
- 'Successfully Executed Task'
- 'Task completed'

ok-ef:
log_path: 'data/apps/ok-ef/working/logs/ok-script.log'
Expand All @@ -67,8 +61,6 @@ parsers:
# 故不可直接用整体状态或全文匹配。此 marker 为栏内判定的关键词,由覆写消费。
daily_success_marker:
- '⭐日常奖励'
success_markers:
- '执行状态: 完成'

March7th-Launcher:
# 上游按 YYYY-MM-DD.log 命名;仅匹配日期日志,排除启动器等其他 .log。
Expand All @@ -95,9 +87,6 @@ parsers:
- '指令[ 等待大世界画面 ] 执行失败 返回状态 未到达大世界'
daily_success_marker:
- '日常奖励领取成功'
success_markers:
- '指令[ 一条龙 ] 执行成功'
- '指令[ 执行应用组 one_dragon ] 执行成功'

BetterGI:
log_path: 'log/better-genshin-impact*.log'
Expand All @@ -108,8 +97,6 @@ parsers:
- '异常:'
daily_success_marker:
- '今日奖励已领取'
success_markers:
- '一条龙和配置组任务结束'
fail_markers:
- '未领取'

Expand Down
26 changes: 19 additions & 7 deletions python-backend/tests/log/test_log_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_daily_completion_determines_status_for_each_parser(self):
),
(
OkWwLogParser,
"INFO claim daily reward via coordinate",
"INFO current daily progress 180",
"INFO TaskExecutor:Successfully Executed Task",
),
(M7ALogParser, "游戏终止:StarRail\n每日实训已完成", "游戏终止:StarRail"),
Expand Down Expand Up @@ -424,7 +424,7 @@ def test_parse_daily_done_driven_by_marker(self):
self.assertFalse(res["daily_done"])
finally:
os.unlink(path)
# 命中「claim daily reward via coordinate」标记 → 当日做完。
# 领取动作本身不代表日常完成。
with tempfile.NamedTemporaryFile(
"w", suffix=".log", delete=False, encoding="utf-8"
) as tf:
Expand All @@ -433,7 +433,7 @@ def test_parse_daily_done_driven_by_marker(self):
try:
p.get_log_path = lambda sp="": Path(path) # type: ignore[method-assign]
res = p.parse("")
self.assertTrue(res["daily_done"])
self.assertFalse(res["daily_done"])
finally:
os.unlink(path)
# 命中「current daily progress 180」(每日进度满分)兜底标记 → 当日做完。
Expand All @@ -449,6 +449,16 @@ def test_parse_daily_done_driven_by_marker(self):
finally:
os.unlink(path)

def test_ok_ww_chinese_daily_markers(self):
parser = OkWwLogParser()
self.assertTrue(
parser.parse_daily("INFO TaskExecutor DailyTask:每日任务已完成")
)
self.assertFalse(
parser.parse_daily("INFO TaskExecutor DailyTask:通过坐标领取每日奖励")
)
self.assertFalse(parser.parse_daily("INFO TaskExecutor DailyTask:每日任务开始"))

def test_parse_logs_report_never_shows_unknown_daily(self):
"""聚合方仅消费定稿后的 daily_done,不得自行产出「未知」。"""
tmp = self.enterContext(tempfile.TemporaryDirectory())
Expand Down Expand Up @@ -724,7 +734,7 @@ def test_oww_stamina_daily_errors(self):
content = (
"info_set current_stamina 240\n"
"info_set back_up_stamina 79\n"
"DailyTask:claim daily reward via coordinate\n"
"DailyTask:info_set current daily progress 180\n"
"TaskExecutor:Successfully Executed Task, Exiting Game and App!\n"
"ERROR CombatCheck:target_enemy failed, try recheck\n" # 噪声:战斗复检
"ERROR TaskExecutor Cantarella:clicked liberation but no effect\n"
Expand Down Expand Up @@ -983,7 +993,7 @@ def test_parse_returns_all_four_fields(self):
) as tf:
tf.write(
"info_set current_stamina 100\n"
"DailyTask:claim daily reward via coordinate\n"
"DailyTask:info_set current daily progress 180\n"
"Successfully Executed Task, Exiting Game and App!"
)
path = tf.name
Expand Down Expand Up @@ -1184,10 +1194,12 @@ def test_keywords_loaded_from_config(self):
oww = OkWwLogParser()
self.assertNotIn("log_pattern", collect_log._keywords_for("ok-ww"))
self.assertEqual(oww.error_markers, ("ERROR",))
# 双空格领奖标记必须原样保留(成败判据即此标记)。
self.assertEqual(
oww.daily_success_marker,
("claim daily reward via coordinate", "current daily progress 180"),
(
"current daily progress 180",
"每日任务已完成",
),
)

bgi = BGILogParser()
Expand Down
Loading