Skip to content

Commit

Permalink
log: using maps.Clone (ethereum#29392)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuiweixie authored Apr 4, 2024
1 parent 6b39e92 commit eea0acc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions log/handler_glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"log/slog"
"maps"
"regexp"
"runtime"
"strconv"
Expand Down Expand Up @@ -145,10 +146,7 @@ func (h *GlogHandler) Enabled(ctx context.Context, lvl slog.Level) bool {

func (h *GlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
h.lock.RLock()
siteCache := make(map[uintptr]slog.Level)
for k, v := range h.siteCache {
siteCache[k] = v
}
siteCache := maps.Clone(h.siteCache)
h.lock.RUnlock()

patterns := []pattern{}
Expand Down

0 comments on commit eea0acc

Please sign in to comment.