Skip to content

trace: update trace.Logger to set family to scope

Warren Gifford requested to merge trace-scoped-logger into main

Created by: bobheadxi

Expands on https://github.com/sourcegraph/sourcegraph/pull/36139 with an additional util, trace.ScopedLogger, that to also set the trace family as a scope on the logger. The scenario in question is:

tr, ctx := s.trace(ctx, "Store.Transact")
logger := trace.Logger(ctx, s.Logger) // `Store.Transact` might be useful info on the logger

I'm not sure whether this should be the default for trace.Logger - might need to poke around or ask about whether folks would set the scope separately from setting the logger. My inclination is probably not? There is one place where this is the case though, and that's in internal/observation - the family name is tracked throughout the layers of Observation and are set manually on the logger scope. There we don't use this utility, however

Test plan

n/a

Merge request reports

Loading