fix: enable DEBUG logging for development (configurable via LOG_LEVEL env var)
This commit is contained in:
@@ -14,7 +14,9 @@ LOG_FILE_PATH = os.path.join(LOGS_DIR, "backend.log")
|
|||||||
|
|
||||||
def setup_logger():
|
def setup_logger():
|
||||||
logger = logging.getLogger("ainventory")
|
logger = logging.getLogger("ainventory")
|
||||||
logger.setLevel(logging.INFO)
|
# Set to DEBUG for development; change to INFO for production
|
||||||
|
log_level = os.environ.get("LOG_LEVEL", "DEBUG")
|
||||||
|
logger.setLevel(getattr(logging, log_level.upper(), logging.INFO))
|
||||||
|
|
||||||
# Avoid duplicate handlers if setup multiple times
|
# Avoid duplicate handlers if setup multiple times
|
||||||
if logger.handlers:
|
if logger.handlers:
|
||||||
|
|||||||
Reference in New Issue
Block a user