Skip to content

Commit 499f78f

Browse files
gballetenriquefynn
authored andcommitted
log: fix staticcheck warnings (ethereum#20388)
1 parent 7e12363 commit 499f78f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

log/handler_glog.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,21 @@ func (h *GlogHandler) Log(r *Record) error {
207207
}
208208
// Check callsite cache for previously calculated log levels
209209
h.lock.RLock()
210-
lvl, ok := h.siteCache[r.Call.PC()]
210+
lvl, ok := h.siteCache[r.Call.Frame().PC]
211211
h.lock.RUnlock()
212212

213213
// If we didn't cache the callsite yet, calculate it
214214
if !ok {
215215
h.lock.Lock()
216216
for _, rule := range h.patterns {
217217
if rule.pattern.MatchString(fmt.Sprintf("%+s", r.Call)) {
218-
h.siteCache[r.Call.PC()], lvl, ok = rule.level, rule.level, true
218+
h.siteCache[r.Call.Frame().PC], lvl, ok = rule.level, rule.level, true
219219
break
220220
}
221221
}
222222
// If no rule matched, remember to drop log the next time
223223
if !ok {
224-
h.siteCache[r.Call.PC()] = 0
224+
h.siteCache[r.Call.Frame().PC] = 0
225225
}
226226
h.lock.Unlock()
227227
}

log/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func LvlFromString(lvlString string) (Lvl, error) {
8383
case "crit":
8484
return LvlCrit, nil
8585
default:
86-
return LvlDebug, fmt.Errorf("Unknown level: %v", lvlString)
86+
return LvlDebug, fmt.Errorf("unknown level: %v", lvlString)
8787
}
8888
}
8989

0 commit comments

Comments
 (0)