Structured JSON logging (core/logging_config.py):
- Replace ad-hoc print() statements with logger.info/warning/error
- Each log line is one JSON object: timestamp (ISO8601 UTC), level, logger,
message, module, exception traceback, plus user-supplied 'extra' fields
- Quiets uvicorn.access and huggingface_hub noise to WARNING
- Configurable via LOG_LEVEL env var
/health endpoint (public, no auth):
- 200 + {"status":"healthy"} → DB ok, predictor loaded
- 200 + {"status":"degraded", ...} → DB ok, predictor still warming
- 503 + {"status":"unhealthy","reason"} → DB unreachable, restart needed
- Compatible with HF Spaces / Railway / uptime monitors
Fail-fast model loading:
- After download attempt, verify distilbert_stage1 exists on disk
- If missing, raise RuntimeError to prevent app from starting in a broken
state where every /api/predict returns 500 at runtime
- Operators can override with ALLOW_DEGRADED_STARTUP=1 (offline dev, etc.)
- Critical-level log includ…