Skip to content

Commit

Permalink
Merge pull request #233 from mars1024/bugfix/threadsafe-set
Browse files Browse the repository at this point in the history
make SetLogger thread-safe
  • Loading branch information
k8s-ci-robot committed Apr 8, 2021
2 parents 3734278 + e95c7e3 commit dda2080
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions klog.go
Expand Up @@ -861,6 +861,9 @@ func (rb *redirectBuffer) Write(bytes []byte) (n int, err error) {
// ...
// klog.SetLogger(zapr.NewLogger(zapLog))
func SetLogger(logr logr.Logger) {
logging.mu.Lock()
defer logging.mu.Unlock()

logging.logr = logr
}

Expand Down

0 comments on commit dda2080

Please sign in to comment.