mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
fix
This commit is contained in:
parent
7340fecf27
commit
0e6c53fda9
16
log/value.go
16
log/value.go
@ -33,15 +33,13 @@ func Value(ctx context.Context, v interface{}) interface{} {
|
||||
func Caller(depth int) Valuer {
|
||||
return func(context.Context) interface{} {
|
||||
_, file, line, _ := runtime.Caller(depth)
|
||||
for true {
|
||||
h := strings.LastIndex(file, "/log/helper.go")
|
||||
f := strings.LastIndex(file, "/log/filter.go")
|
||||
if h > 0 || f > 0 {
|
||||
depth++
|
||||
_, file, line, _ = runtime.Caller(depth)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
if strings.LastIndex(file, "/log/helper.go") > 0 {
|
||||
depth++
|
||||
_, file, line, _ = runtime.Caller(depth)
|
||||
}
|
||||
if strings.LastIndex(file, "/log/filter.go") > 0 {
|
||||
depth++
|
||||
_, file, line, _ = runtime.Caller(depth)
|
||||
}
|
||||
idx := strings.LastIndexByte(file, '/')
|
||||
return file[idx+1:] + ":" + strconv.Itoa(line)
|
||||
|
Loading…
x
Reference in New Issue
Block a user