替换slog日志为zap

This commit is contained in:
duanhf2012
2024-11-29 13:47:27 +08:00
parent 000853b479
commit 61de4bba3a
33 changed files with 404 additions and 913 deletions

View File

@@ -281,7 +281,7 @@ func (m *Module) SafeNewTicker(tickerId *uint64, d time.Duration, AdditionData i
func (m *Module) CancelTimerId(timerId *uint64) bool {
if timerId == nil || *timerId == 0 {
log.Warning("timerId is invalid")
log.Warn("timerId is invalid")
return false
}
@@ -292,7 +292,7 @@ func (m *Module) CancelTimerId(timerId *uint64) bool {
t, ok := m.mapActiveIdTimer[*timerId]
if ok == false {
log.Stack("cannot find timer id ", log.Uint64("timerId", *timerId))
log.StackError("cannot find timer id ", log.Uint64("timerId", *timerId))
return false
}

View File

@@ -11,7 +11,6 @@ import (
"github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/v2/util/timer"
"reflect"
"runtime"
"strconv"
"sync"
"sync/atomic"
@@ -261,10 +260,7 @@ func (s *Service) SetName(serviceName string) {
func (s *Service) Release() {
defer func() {
if r := recover(); r != nil {
buf := make([]byte, 4096)
l := runtime.Stack(buf, false)
errString := fmt.Sprint(r)
log.Dump(string(buf[:l]), log.String("error", errString))
log.StackError(fmt.Sprint(r))
}
}()

View File

@@ -23,7 +23,7 @@ func Init() {
for _,s := range setupServiceList {
err := s.OnInit()
if err != nil {
log.Error("Failed to initialize "+s.GetName()+" service",log.ErrorAttr("err",err))
log.Error("Failed to initialize "+s.GetName()+" service",log.ErrorField("err",err))
os.Exit(1)
}
}