fix: ユーザー任意停止時のログ結果を「エラー」から「手動停止」に変更

意図的な停止操作をエラー扱いすると、ログ確認時に異常発生と誤認するため専用カテゴリに分離。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Kenichiro NOGI 2026-08-02 10:31:32 +09:00
parent 8f08609355
commit 1c1d47e3fa
3 changed files with 7 additions and 2 deletions

View File

@ -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 | 備考=...
```
- エラー時、備考欄にスタックトレース概要含める

View File

@ -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

View File

@ -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)