add caller info & stdout

master v0.0.5
guohao 5 years ago
parent 199f680758
commit 89f40eb920
  1. 4
      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)
}

Loading…
Cancel
Save