feat(backend): daily request-tagged log files + print job lifecycle logging

Platform v2 step 0.4 (APPS_PLATFORM §10). New core/logging.py:
- root logger -> stderr + <db dir>/logs/xenia-YYYY-MM-DD.log (UTC date,
  /app/data/logs in Docker, $LOG_DIR overrides); files older than the
  system.log_retention_days setting (default 30) are pruned
- line format: UTC ISO time, level, logger, [req= user= device=], message
- RequestContextMiddleware (pure ASGI): request id per request, X-Request-ID
  response header, one http line per request (DEBUG for plain reads)
- auth tags the user via set_log_context; uvicorn loggers routed through ours
Print jobs now log created / attempt / success / failed / abandoned with the
job id, so a missing ticket can be traced. Removed cloud_sync's basicConfig.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 16:31:38 +02:00
co-authored by Claude Opus 5.5
parent e560d93cd5
commit 9fa728c039
9 changed files with 432 additions and 7 deletions
+3
View File
@@ -1685,6 +1685,9 @@ def cancel_print_job(
item.printed = True
db.commit()
import logging
logging.getLogger("services.printer_service").warning(
"print.job.abandoned job=%s order=%s attempts=%s reason=staff_cancelled", pj.id, order_id, pj.retry_count)
broadcast_sync("order_updated", {"order_id": order_id, "table_id": order.table_id, "status": order.status, "action": "print_job_cancelled"})
return {"ok": True, "job_id": job_id}