1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-07 23:02:12 +02:00

fix log caller (#1025)

This commit is contained in:
包子 2021-06-09 20:44:23 +08:00 committed by GitHub
parent 05c2e16b9e
commit 5d1228a5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,7 +33,7 @@ func Value(ctx context.Context, v interface{}) interface{} {
func Caller(depth int) Valuer {
return func(context.Context) interface{} {
_, file, line, _ := runtime.Caller(depth)
if strings.LastIndex(file, "github.com/go-kratos/kratos/log") > 0 {
if strings.LastIndex(file, "/log/helper.go") > 0 {
_, file, line, _ = runtime.Caller(depth + 1)
}
idx := strings.LastIndexByte(file, '/')