Skip to content

Commit

Permalink
log: fix staticcheck warnings (ethereum#20388)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet authored and gzliudan committed Nov 12, 2024
1 parent 47203c8 commit e2ec082
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions log/handler_glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,21 @@ func (h *GlogHandler) Log(r *Record) error {
}
// Check callsite cache for previously calculated log levels
h.lock.RLock()
lvl, ok := h.siteCache[r.Call.PC()]
lvl, ok := h.siteCache[r.Call.Frame().PC]
h.lock.RUnlock()

// If we didn't cache the callsite yet, calculate it
if !ok {
h.lock.Lock()
for _, rule := range h.patterns {
if rule.pattern.MatchString(fmt.Sprintf("%+s", r.Call)) {
h.siteCache[r.Call.PC()], lvl, ok = rule.level, rule.level, true
h.siteCache[r.Call.Frame().PC], lvl, ok = rule.level, rule.level, true
break
}
}
// If no rule matched, remember to drop log the next time
if !ok {
h.siteCache[r.Call.PC()] = 0
h.siteCache[r.Call.Frame().PC] = 0
}
h.lock.Unlock()
}
Expand Down

0 comments on commit e2ec082

Please sign in to comment.