Django logging middleware and trace id bound to logger
Description
Add Django middleware to log every request and to ensure all requests include a unqie ID that ties logs together for each request.
Reference to example middleware logging (not structlog based):
Acceptance criteria
-
middleware logs all requests start and end when middleware including in settings -
method -
paths -
status -
duration
-
-
GCP trace ID or manually generated value if missing bound to loggers -
get_structlog_logger
method added to library (returns logger fromstructlog.get_logger
, bound when in a request context) -
align fields with GCP special field names (those within current scope). E.g. "message" vs "event" https://cloud.google.com/logging/docs/structured-logging