API structured logging #3432
Labels
🤖 aspect: dx
Concerns developers' experience with the codebase
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
help wanted
Open to participation from the community
🟨 priority: medium
Not blocking but should be addressed soon
🧱 stack: api
Related to the Django API
🔧 tech: django
Involves Django
🐍 tech: python
Involves Python
Milestone
Problem
See the milestone description for the rationale: https://github.com/WordPress/openverse/milestone/20
Description
Add
django-structlog
to the API configuration: https://github.com/jrobichaud/django-structlog. When doing this, we can also remove the request ID middleware, as it'll no longer be necessary,django-structlog
has that built in.We should keep the response headers added in #3368, even though
django-structlog
logs some of those, because they're still useful in Cloudflare (we can reference response headers in WAF rules, for example).For ease of reading in local development, add a switch to default to flat line style logs when
ENVIRONMENT == "local"
.The text was updated successfully, but these errors were encountered: