You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Loggers: pass contextual info as explicit arguments instead of via context (follow-up to #133) #334
Follow-up to #133. PR #331 added extensions.LogInfosFromContext, a non-breaking helper so custom loggers can pull the controller's contextual values (channel, correlation ID, direction, provider, broker message, version) out of the context.Context in one call. This issue tracks the remaining, breaking part of #133.
Goal
Stop relying on the context.Context to carry logging metadata into the loggers:
The generated code should pass the contextual values (channel, correlation ID, direction, …) to the logger as explicit LogInfo arguments at each c.logger.Info/Warning/Error(...) call site.
The built-in loggers (Text, ECS) should drop their context-enrichment (setInfoFromContext) and log only what they are given.
The context values themselves should still be set in the generated code (the context stays useful for other purposes) — only the loggers stop reading from it.
This makes custom loggers trivial: they receive everything as arguments and never have to unwrap context keys.
Why it's deferred
This is a breaking, repo-wide change:
It alters every generated c.logger.* call (regenerating all golden files).
It changes the output sourcing of the built-in Text/ECS loggers, which currently enrich from context — users relying on that behavior would be affected.
LogInfosFromContext (from #331) can be reused as the single source of truth for which values to attach, so the built-in loggers and the generated call sites stay consistent.
Scope / acceptance
Generated controller code attaches the contextual LogInfos explicitly at each log call.
Text and ECS loggers no longer call setInfoFromContext (built on LogInfosFromContext).
Decide and document the migration/compatibility story for custom loggers and for users depending on the current context-enrichment.
Regenerate golden files; update examples and docs.
Activity