diff --git a/PythonProj/ScanOCR/docs/superpowers/specs/2026-08-02-watch-launcher-design.md b/PythonProj/ScanOCR/docs/superpowers/specs/2026-08-02-watch-launcher-design.md index 6694d0ac..c78bcdeb 100644 --- a/PythonProj/ScanOCR/docs/superpowers/specs/2026-08-02-watch-launcher-design.md +++ b/PythonProj/ScanOCR/docs/superpowers/specs/2026-08-02-watch-launcher-design.md @@ -120,7 +120,7 @@ DPI=300 - 出力先: `ログ/YYYY-MM-DD.log`(日付別、UTF-8 BOM付き) - 1件1行、フォーマット: ``` - [YYYY-MM-DD HH:MM:SS] 結果=成功|失敗|スキップ|エラー | 元ファイル=xxx.pdf | 氏名=xxx | 日付=xxx | 備考=... + [YYYY-MM-DD HH:MM:SS] 結果=成功|失敗|スキップ|エラー|手動停止 | 元ファイル=xxx.pdf | 氏名=xxx | 日付=xxx | 備考=... ``` - エラー時、備考欄にスタックトレース概要含める diff --git a/PythonProj/ScanOCR/スクリプト/extract_and_rename.py b/PythonProj/ScanOCR/スクリプト/extract_and_rename.py index 46a35a63..158a49d3 100644 --- a/PythonProj/ScanOCR/スクリプト/extract_and_rename.py +++ b/PythonProj/ScanOCR/スクリプト/extract_and_rename.py @@ -186,7 +186,7 @@ def run_queue( if key_check(): append_log( - log_dir, "エラー", pdf_path.name, None, None, + log_dir, "手動停止", pdf_path.name, None, None, "ユーザー操作により停止しました", ) break diff --git a/PythonProj/ScanOCR/スクリプト/tests/test_extract_and_rename.py b/PythonProj/ScanOCR/スクリプト/tests/test_extract_and_rename.py index 8a6aec85..dd94dfe3 100644 --- a/PythonProj/ScanOCR/スクリプト/tests/test_extract_and_rename.py +++ b/PythonProj/ScanOCR/スクリプト/tests/test_extract_and_rename.py @@ -157,6 +157,11 @@ def test_run_queue_stops_on_key_press(tmp_path): assert calls == [] assert pdf.exists() # 処理されず残る + from datetime import datetime + log_content = (dirs["log"] / f"{datetime.now().strftime('%Y-%m-%d')}.log").read_text(encoding="utf-8-sig") + assert "結果=手動停止" in log_content + assert "結果=エラー" not in log_content + def test_run_queue_skips_file_deleted_before_processing(tmp_path): dirs = _make_dirs(tmp_path)