log: using maps.Clone (#29392)
This commit is contained in:
parent
6b39e9236c
commit
eea0acc549
@ -21,6 +21,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"maps"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -145,10 +146,7 @@ func (h *GlogHandler) Enabled(ctx context.Context, lvl slog.Level) bool {
|
|||||||
|
|
||||||
func (h *GlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
func (h *GlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
||||||
h.lock.RLock()
|
h.lock.RLock()
|
||||||
siteCache := make(map[uintptr]slog.Level)
|
siteCache := maps.Clone(h.siteCache)
|
||||||
for k, v := range h.siteCache {
|
|
||||||
siteCache[k] = v
|
|
||||||
}
|
|
||||||
h.lock.RUnlock()
|
h.lock.RUnlock()
|
||||||
|
|
||||||
patterns := []pattern{}
|
patterns := []pattern{}
|
||||||
|
Loading…
Reference in New Issue
Block a user