This commit is contained in:
wangchuxiao 2023-01-12 16:31:44 +08:00
parent 6c7b80f853
commit e67dc28e82

View File

@ -180,11 +180,12 @@ func SetContextInfo(ctx context.Context, funcName string, logLevel logrus.Level,
funcInfo.Err = err
funcInfo.LogLevel = logLevel
_, file, line, _ := runtime.Caller(0)
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)
}
funcInfo.File = file
funcInfo.File = s
*t.Funcs = append(*t.Funcs, funcInfo)
}