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