Don't log if LOG_FILE isn't set

This commit is contained in:
Lutchy Horace 2025-04-02 11:01:15 -04:00
parent 71972e5f8d
commit 9743d7670b

View file

@ -60,14 +60,15 @@ redis_client = redis.Redis(
)
# Setup logging
# Set up logging
handlers = [logging.StreamHandler()] # Always log to stdout
if LOG_FILE and LOG_FILE.strip(): # Log to file only if LOG_FILE is set and not empty
handlers.append(logging.FileHandler(LOG_FILE))
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(CONFIG["LOG_FILE"]),
logging.StreamHandler()
]
handlers=handlers
)
def parse_size(size_str):