优化日志,避免一些变量的逃逸

This commit is contained in:
boyce
2021-07-01 16:27:48 +08:00
parent 7392d90ef2
commit d9333e31c0
22 changed files with 157 additions and 141 deletions

View File

@@ -95,7 +95,7 @@ func tick() bool{
t := heap.Pop(&timerHeap).(*Timer)
timerHeapLock.Unlock()
if len(t.C)>= cap(t.C) {
log.Error("Timer channel full!")
log.SError("Timer channel full!")
return true
}

View File

@@ -95,7 +95,7 @@ func (t *Timer) Do(){
buf := make([]byte, 4096)
l := runtime.Stack(buf, false)
err := fmt.Errorf("%v: %s", r, buf[:l])
log.Error("core dump info:%+v\n", err)
log.SError("core dump info:", err.Error())
}
}()
t.cb()