mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
log
This commit is contained in:
parent
57928f900e
commit
022da8bdbd
1
internal/rpc/cache/cache.go
vendored
1
internal/rpc/cache/cache.go
vendored
@ -105,7 +105,6 @@ func (s *cacheServer) DelFriendIDListFromCache(ctx context.Context, req *pbCache
|
||||
if err := rocksCache.DelFriendIDListFromCache(ctx, req.UserID); err != nil {
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", resp.String())
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -242,13 +242,11 @@ func ShowLog(ctx context.Context) {
|
||||
OperationID := trace_log.GetOperationID(ctx)
|
||||
if ctx.Value(trace_log.TraceLogKey).(*trace_log.ApiInfo).GinCtx != nil {
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": ctxLogger.Type,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
}).Infoln("api: ", t.ApiName)
|
||||
} else {
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": ctxLogger.Type,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
}).Infoln("rpc: ", t.ApiName)
|
||||
@ -256,7 +254,6 @@ func ShowLog(ctx context.Context) {
|
||||
for _, v := range *t.Funcs {
|
||||
if v.Err != nil {
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": v.File,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
"FilePath": v.File,
|
||||
@ -265,21 +262,18 @@ func ShowLog(ctx context.Context) {
|
||||
switch v.LogLevel {
|
||||
case logrus.InfoLevel:
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": v.File,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
"FilePath": v.File,
|
||||
}).Infoln("func: ", v.FuncName, " args: ", v.Args)
|
||||
case logrus.DebugLevel:
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": v.File,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
"FilePath": v.File,
|
||||
}).Debugln("func: ", v.FuncName, " args: ", v.Args)
|
||||
case logrus.WarnLevel:
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"Type": v.File,
|
||||
"OperationID": OperationID,
|
||||
"PID": ctxLogger.Pid,
|
||||
"FilePath": v.File,
|
||||
|
@ -179,11 +179,11 @@ func SetContextInfo(ctx context.Context, funcName string, logLevel logrus.Level,
|
||||
funcInfo.FuncName = funcName
|
||||
funcInfo.Err = err
|
||||
funcInfo.LogLevel = logLevel
|
||||
_, file, line, _ := runtime.Caller(2)
|
||||
_, file, line, _ := runtime.Caller(3)
|
||||
var s string
|
||||
i := strings.SplitAfter(file, "/")
|
||||
if len(i) > 3 {
|
||||
file = i[len(i)-3] + i[len(i)-2] + i[len(i)-1] + ":" + utils.IntToString(line)
|
||||
s = i[len(i)-3] + i[len(i)-2] + i[len(i)-1] + ":" + utils.IntToString(line)
|
||||
}
|
||||
fmt.Println(funcInfo.FuncName, "file", s, file)
|
||||
funcInfo.File = s
|
||||
|
Loading…
x
Reference in New Issue
Block a user