Enable debugging by default on dev builds.

This commit is contained in:
Matthew Stratford 2022-03-11 23:29:46 +00:00
parent 853efa6968
commit 7400272778

View file

@ -1,7 +1,9 @@
import logging
from logging.handlers import RotatingFileHandler
from typing import Optional
from helpers.os_environment import resolve_external_file_path
import os
import package
LOG_MAX_SIZE_MB = 20
LOG_BACKUP_COUNT = 4
@ -11,7 +13,7 @@ class LoggingManager:
logger: logging.Logger
def __init__(self, name: str, debug: bool = False):
def __init__(self, name: str, debug: Optional[bool] = None):
self.logger = logging.getLogger(name)
logpath: str = resolve_external_file_path("/logs")
@ -34,6 +36,10 @@ class LoggingManager:
print("Failed to create log file.")
return
# Enable debug by default
if (debug == None and package.BETA):
debug = True
self.logger.setLevel(logging.DEBUG if debug else logging.INFO)
fh = RotatingFileHandler(
filename,