Refactor logging setup to use Loguru in WSGI and views for improved logging consistency and debugging

This commit is contained in:
Ross
2026-03-02 11:09:05 +00:00
parent 12e3d47600
commit 6ff8706fa4
2 changed files with 4 additions and 7 deletions
+3
View File
@@ -13,6 +13,7 @@ from django.core.wsgi import get_wsgi_application
from loguru import logger
import sys
from pathlib import Path
import logging
# Configure Loguru sinks early so app imports see consistent logging.
# Log to stdout (so `docker logs` shows messages) and to a file at
@@ -35,6 +36,8 @@ try:
serialize=True,
)
logger.debug("Loguru logging configured with stdout and file sinks")
logging.root.setLevel(logging.DEBUG)
except Exception:
# Best-effort only — don't crash WSGI startup if logging can't be configured
try: