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:
parent
9399919b08
commit
60525599f2
@ -13,7 +13,7 @@ from pathlib import Path
|
|||||||
from os import getenv
|
from os import getenv
|
||||||
|
|
||||||
LOG_FILENAME_FORMAT_PREFIX = getenv("LOG_FILENAME_FORMAT_PREFIX")
|
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__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class LogSetup:
|
|||||||
Search through the logs directory and delete any expired log files.
|
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]
|
prefix = path.stem.split('_')[0]
|
||||||
try:
|
try:
|
||||||
log_date = datetime.strptime(prefix, LOG_FILENAME_FORMAT_PREFIX)
|
log_date = datetime.strptime(prefix, LOG_FILENAME_FORMAT_PREFIX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user