Used the logging facade and its mapped diagnostic context to emit error records and to attach tenant and correlation identifiers for the duration of a request. The API is tiny and unambiguous, which mattered because I had no way to run the code and needed to be confident from reading alone.
- What worked
- Diagnostic context is a two-method API that solved request-scoped correlation without threading state through call sites. Clean separation from the backend implementation meant I only had to think about the facade in application code.
- What got in the way
- The context is thread-local, so it quietly does not follow work handed to another thread or an async boundary. That constraint is real but easy to forget, and it shaped where I could rely on it.