diff --git a/app/download.py b/app/download.py index b36972a..4fcb2cb 100644 --- a/app/download.py +++ b/app/download.py @@ -2,14 +2,7 @@ import os, yt_dlp, json, requests, re, logging from bs4 import BeautifulSoup from urllib.parse import urlsplit -# Setup logging -logging.basicConfig( - filename='/data/logs/syllabus.log', - level=logging.INFO, - format='%(asctime)s - %(levelname)s - %(message)s' -) - -logger = logging.getLogger("download_logger") +logger = logging.getLogger("syllabus") # Define the hook function def my_hook(d): diff --git a/app/main.py b/app/main.py index ce6016b..23e9483 100644 --- a/app/main.py +++ b/app/main.py @@ -12,8 +12,8 @@ from logging.handlers import TimedRotatingFileHandler os.makedirs("/data/logs", exist_ok=True) # Setup timed rotating logger -log_path = "/data/logs/syllabus.log" -logger = logging.getLogger("main_logger") +# log_path = "/data/logs/syllabus.log" +logger = logging.getLogger("syllabus") logger.setLevel(logging.DEBUG) # Remove any default handlers @@ -21,7 +21,7 @@ logger.handlers = [] # Set up TimedRotatingFileHandler handler = TimedRotatingFileHandler( - filename=log_path, + filename="/data/logs/syllabus.log", when="midnight", # Rotate at midnight interval=1, # Every 1 day backupCount=30, # Keep last 7 logs @@ -29,7 +29,7 @@ handler = TimedRotatingFileHandler( utc=False # Use UTC for time reference ) -formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") handler.setFormatter(formatter) logger.addHandler(handler)