From 7e9234e71262332b789c78a227681eb613983fce Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Fri, 4 Mar 2022 17:13:23 +0800 Subject: [PATCH] log --- pkg/common/log/file_line_hk.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/common/log/file_line_hk.go b/pkg/common/log/file_line_hk.go index 35dd34912..7e079b79f 100644 --- a/pkg/common/log/file_line_hk.go +++ b/pkg/common/log/file_line_hk.go @@ -31,9 +31,9 @@ func (f *fileHook) Levels() []logrus.Level { func (f *fileHook) Fire(entry *logrus.Entry) error { var s string _, b, c, _ := runtime.Caller(8) - i := strings.LastIndex(b, "/") - if i != -1 { - s = b[i+1:len(b)] + ":" + utils.IntToString(c) + i := strings.SplitAfter(b, "/") + if len(i) > 3 { + s = i[len(i)-3] + i[len(i)-2] + i[len(i)-1] + ":" + utils.IntToString(c) } entry.Data["FilePath"] = s return nil