Don't log if LOG_FILE isn't set
This commit is contained in:
parent
71972e5f8d
commit
9743d7670b
1 changed files with 6 additions and 5 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue