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
Renames the current (unreleased at the time of writing)
LoggerFromContext to LoggerFrom, and adds a new alias named LoggerInto.
From a user standpoint these new aliases are really clear and
straightfoward, example:
```go
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) {
log := ctrl.LoggerFrom(ctx)
```
This reads much better than ctrl.LoggerFromContext(ctx) which repeats
the context.
Another use case that this change solves is to enrich the logger with
more values, example:
```go
ctx = ctrl.LoggerInto(ctx, log.WithValues(...))
```
allows the ctx to still be the de-facto context, and the logger for the
inner reconciler function to still only accept ctx, without adding any
more parameters.
Signed-off-by: Vince Prignano <[email protected]>
0 commit comments