From 340036e9bd43a40f47ad170eeb9913590bf76251 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Fri, 2 Oct 2026 14:01:36 +0200 Subject: [PATCH] Agents: add a note for logging Based on https://github.com/readthedocs/readthedocs.org/pull/13326 --- AGENTS.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 0863c7e..ba36659 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,6 +94,14 @@ Always run `tox -e migrations` after adding or modifying migration files. This r `manage.py makemigrations --check --dry-run` and catches missing or inconsistent migrations before they cause `IntegrityError` failures at deploy time. +## Logging + +- Use `structlog` keyword arguments for context, never string interpolation +- Name keys as `_`: `project_slug`, `build_id`, `user_username`, `organization_slug` +- Use `_id`, not `_pk`: `invitation_id=invitation.pk` +- Don't use bare keys like `project=`, `build=`, or `username=` +- Bind repeated context once with `log.bind(...)` instead of passing it to every call + ## Front-end - Most templates/css/js are in a separate repository (https://github.com/readthedocs/ext-theme/).