feat: 在处理文件时添加更新检查日志,增强可追踪性

This commit is contained in:
2025-04-11 23:05:22 +08:00
parent 6a5fec87e3
commit 896d085e8d

View File

@@ -49,12 +49,14 @@ def process_item(item):
os.makedirs(os.path.dirname(abs_file_path), exist_ok=True) os.makedirs(os.path.dirname(abs_file_path), exist_ok=True)
updated = False updated = False
logging.info(f"📝 检查 {abs_file_path} 是否需要更新")
if os.path.exists(abs_file_path): if os.path.exists(abs_file_path):
with open(abs_file_path, "r", encoding="utf-8") as f: with open(abs_file_path, "r", encoding="utf-8") as f:
old_content = f.read() old_content = f.read()
if old_content != new_content: if old_content != new_content:
updated = True updated = True
else: else:
logging.warning(f"⚠️ 文件 {file_path} 不存在,将创建。")
updated = True updated = True
if updated: if updated: