Description
The current logging interface does not seem to allow callers to inject structured fields, such as trace ids, into the log lines. While custom loggers are acceptable, only global instances are acceptable, and the logging interface only passes Stripe's log messages as arguments.
In my setup, I use context.Context
to pass request ids into my logger, which in turn includes these request ids in the structured log lines that are written to stderr. Systems like OpenCensus/OpenTelemetry/OpenTracing also use context to pass correlation tokens through.
It would be nice if the Stripe SDK had support for this, so that I could more easily correlate Stripe's logging with incoming requests. While it is possible to do this to a certain extent by overriding the http.Transaport
, I'd like to take full advantage of the diagnostic logging that is already built into this library.
I am curious if this has already been thought through, or if others have solutions. If not, it would be great to add support for this into the logging interfaces.
The current API, for reference:
Lines 181 to 195 in ebbff36
Lines 124 to 142 in ebbff36
Activity