fixed old logs not being deleted

for some reason was checking logs dir for .txt files instead of .log files during the delete function.
This commit is contained in:
Corban-Lee Jones 2024-02-18 22:30:25 +00:00
parent 9399919b08
commit 60525599f2

View File

@ -13,7 +13,7 @@ from pathlib import Path
from os import getenv
LOG_FILENAME_FORMAT_PREFIX = getenv("LOG_FILENAME_FORMAT_PREFIX")
MAX_LOGFILE_AGE_DAYS = getenv("MAX_LOGFILE_AGE_DAYS")
MAX_LOGFILE_AGE_DAYS = int(getenv("MAX_LOGFILE_AGE_DAYS"))
log = logging.getLogger(__name__)
@ -47,7 +47,7 @@ class LogSetup:
Search through the logs directory and delete any expired log files.
"""
for path in self.logs_dir.glob('*.txt'):
for path in self.logs_dir.glob('*.log'):
prefix = path.stem.split('_')[0]
try:
log_date = datetime.strptime(prefix, LOG_FILENAME_FORMAT_PREFIX)