Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-JIRA: Add static.Logger() so new code can use non-static patterns. #27

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions log/static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ func SetLogger(replacement logr.Logger) {
logger = replacement
}

// Logger returns the static logger instance.
func Logger() logr.Logger {
lock.RLock()
defer lock.RUnlock()
return logger
}

// WithName returns a logger with name added to the component.
// This uses the static logger instance.
func WithName(name string) logr.Logger {
Expand Down