mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
zap
This commit is contained in:
parent
f18b03987e
commit
c04b85aa29
@ -3,6 +3,7 @@ package log
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@ -111,7 +112,9 @@ func (l *ZapLogger) cores(isStdout bool, isJson bool, logLocation string, rotate
|
||||
c.EncodeLevel = l.CapitalColorLevelEncoder
|
||||
customCallerEncoder := func(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
|
||||
s := "[" + caller.TrimmedPath() + "]"
|
||||
pid := fmt.Sprintf("["+"PID:"+"%d"+"]", os.Getpid())
|
||||
enc.AppendString(_levelToColor[l.level].Add(s))
|
||||
enc.AppendString(_levelToColor[l.level].Add(pid))
|
||||
}
|
||||
c.EncodeCaller = customCallerEncoder
|
||||
fileEncoder = zapcore.NewConsoleEncoder(c)
|
||||
|
Loading…
x
Reference in New Issue
Block a user