From 89f40eb920cc4fc3d8e081e7689740d343b33f2c Mon Sep 17 00:00:00 2001 From: guohao Date: Thu, 8 Aug 2019 16:41:34 +0800 Subject: [PATCH] add caller info & stdout --- gokit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gokit.go b/gokit.go index 06ff1f4..f1426b0 100644 --- a/gokit.go +++ b/gokit.go @@ -90,8 +90,8 @@ func getLevelName(level Level) string { func format(msg string) string { if withCaller { - funcName, file, line, _ := runtime.Caller(2) - return fmt.Sprintf("%s [%s] %s:%d::%s %s \n", time.Now().Format("2006-01-02 15:04:05.999"), logLevelName, file, line, funcName, msg) + _, file, line, _ := runtime.Caller(3) + return fmt.Sprintf("%s [%s] %s:%d %s \n", time.Now().Format("2006-01-02 15:04:05.999"), logLevelName, file, line, msg) } else { return fmt.Sprintf("%s [%s] %s \n", time.Now().Format("2006-01-02 15:04:05.999"), logLevelName, msg) }