mirror of
https://github.com/golang/go
synced 2024-11-23 05:40:04 -07:00
log/slog: use atomic.Pointer instead of atomic.Value
There is no need to use atomic.Value, atomic.Pointer should also
be more performant here.
Change-Id: I04cc1befbe1112665a9d9e16197ea3caef5e5fa3
GitHub-Last-Rev: 577902519f
GitHub-Pull-Request: golang/go#62288
Reviewed-on: https://go-review.googlesource.com/c/go/+/523035
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
This commit is contained in:
parent
92f7209ebd
commit
111ab75432
@ -14,14 +14,14 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var defaultLogger atomic.Value
|
||||
var defaultLogger atomic.Pointer[Logger]
|
||||
|
||||
func init() {
|
||||
defaultLogger.Store(New(newDefaultHandler(loginternal.DefaultOutput)))
|
||||
}
|
||||
|
||||
// Default returns the default Logger.
|
||||
func Default() *Logger { return defaultLogger.Load().(*Logger) }
|
||||
func Default() *Logger { return defaultLogger.Load() }
|
||||
|
||||
// SetDefault makes l the default Logger.
|
||||
// After this call, output from the log package's default Logger
|
||||
|
Loading…
Reference in New Issue
Block a user