Skip to content

Commit e50bc83

Browse files
authored
Merge pull request #1202 from vincepri/loggerfrominto
🌱 Add ctrl.{LoggerFrom, LoggerInto}
2 parents df9195b + 8a00ec4 commit e50bc83

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

alias.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,15 @@ var (
125125
// get any actual logging.
126126
Log = log.Log
127127

128-
// LoggerFromContext returns a logger with predefined values from a context.Context.
128+
// LoggerFrom returns a logger with predefined values from a context.Context.
129129
//
130130
// This is meant to be used with the context supplied in a struct that satisfies the Reconciler interface.
131-
LoggerFromContext = log.FromContext
131+
LoggerFrom = log.FromContext
132+
133+
// LoggerInto takes a context and sets the logger as one of its keys.
134+
//
135+
// This is meant to be used in reconcilers to enrich the logger within a context with additional values.
136+
LoggerInto = log.IntoContext
132137

133138
// SetLogger sets a concrete logging implementation for all deferred Loggers.
134139
SetLogger = log.SetLogger

0 commit comments

Comments
 (0)