1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:05:06 -07:00

log/slog: use atomic.Pointer instead of atomic.Value

This commit is contained in:
Mateusz Poliwczak 2023-08-25 17:33:50 +02:00
parent d5c5808534
commit 577902519f

View File

@ -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