微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
20
scripts/ops/_check_latest_log.py
Normal file
20
scripts/ops/_check_latest_log.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""查看最新 ETL 日志的最后 50 行"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(Path(__file__).resolve().parents[2] / ".env")
|
||||
log_root = Path(os.environ["LOG_ROOT"])
|
||||
|
||||
logs = sorted(log_root.glob("*.log"), key=lambda p: p.stat().st_mtime, reverse=True)
|
||||
if not logs:
|
||||
print("无日志文件")
|
||||
else:
|
||||
latest = logs[0]
|
||||
print(f"最新日志: {latest.name} ({latest.stat().st_size} bytes)")
|
||||
print(f"修改时间: {latest.stat().st_mtime}")
|
||||
lines = latest.read_text(encoding="utf-8", errors="replace").splitlines()
|
||||
print(f"总行数: {len(lines)}")
|
||||
print(f"\n--- 最后 60 行 ---")
|
||||
for line in lines[-60:]:
|
||||
print(line)
|
||||
Reference in New Issue
Block a user