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
31ff1cb673
commit
82c32d24a1
@ -3,8 +3,11 @@ package log
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/trace_log"
|
||||
"Open_IM/pkg/utils"
|
||||
"bufio"
|
||||
"context"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
//"bufio"
|
||||
"fmt"
|
||||
@ -252,6 +255,15 @@ func ShowLog(ctx context.Context) {
|
||||
}).Infoln("rpc: ", t.ApiName)
|
||||
}
|
||||
for _, v := range *t.Funcs {
|
||||
if v.File == "" {
|
||||
_, file, line, _ := runtime.Caller(1)
|
||||
var s string
|
||||
i := strings.SplitAfter(file, "/")
|
||||
if len(i) > 3 {
|
||||
s = i[len(i)-3] + i[len(i)-2] + i[len(i)-1] + ":" + utils.IntToString(line)
|
||||
}
|
||||
v.File = s
|
||||
}
|
||||
if v.Err != nil {
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"OperationID": OperationID,
|
||||
|
@ -185,7 +185,6 @@ func SetContextInfo(ctx context.Context, funcName string, logLevel logrus.Level,
|
||||
if len(i) > 3 {
|
||||
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
|
||||
*t.Funcs = append(*t.Funcs, funcInfo)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user