-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Go Drivers
Context
A common use for a Context is passing around request-scoped information so it can be added to log messages (e.g. request ID, user ID, etc). The current options.LogSink interface doesn't support passing the Context passed to an operation through to the logging implementation, meaning there's no simple way to access user-defined request-scoped data from the LogSink calls.
For example, I want to pass a Context containing the current application user ID to an Insert MongoDB operation call. Then, in my LogSink adapter, I want to be able to access that Context and retrieve the user ID so I can add it to the logged message.
Definition of done
- Investigate ways to pass Context values to the LogSink calls without changing the LogSink API.
- Investigate ways to modify the LogSink API to allow passing Context values.
- For Go Driver v3.x, consider updating the LogSink API to work better with the new slog package, which supports passing Context values.