From ef928209549b76ce370742f78c8ffb1c96da47e4 Mon Sep 17 00:00:00 2001 From: Yanxin Lu Date: Sun, 22 Feb 2026 14:21:10 -0800 Subject: [PATCH] append logging and clear logging in main loop --- scripts/news_digest/main.py | 4 ++++ scripts/news_digest/run.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/news_digest/main.py b/scripts/news_digest/main.py index 6c63ec6..ace12b4 100644 --- a/scripts/news_digest/main.py +++ b/scripts/news_digest/main.py @@ -381,6 +381,10 @@ def main(): # Fetch feeds if not args.no_fetch: + # Clear log file before starting a new fetch cycle + log_file = Path(__file__).resolve().parent / "news_digest.log" + log_file.write_text("") + feeds = config.get("feeds", []) total_new = 0 diff --git a/scripts/news_digest/run.sh b/scripts/news_digest/run.sh index 3827fc4..159d85f 100755 --- a/scripts/news_digest/run.sh +++ b/scripts/news_digest/run.sh @@ -2,4 +2,4 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" LOG_FILE="$SCRIPT_DIR/news_digest.log" -uv run --python 3.12 --with-requirements "$SCRIPT_DIR/requirements.txt" "$SCRIPT_DIR/main.py" -v "$@" 2>"$LOG_FILE" +uv run --python 3.12 --with-requirements "$SCRIPT_DIR/requirements.txt" "$SCRIPT_DIR/main.py" -v "$@" 2>>"$LOG_FILE"