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 enriquefynn committed Feb 15, 2021
1 parent 7e12363 commit 499f78f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions log/handler_glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,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
2 changes: 1 addition & 1 deletion log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func LvlFromString(lvlString string) (Lvl, error) {
case "crit":
return LvlCrit, nil
default:
return LvlDebug, fmt.Errorf("Unknown level: %v", lvlString)
return LvlDebug, fmt.Errorf("unknown level: %v", lvlString)
}
}

Expand Down

0 comments on commit 499f78f

Please sign in to comment.