diff --git a/main.go b/main.go index 2bf85a6c..ef17868f 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,10 @@ package main import ( + "fmt" "os" + "path" + "runtime" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -25,6 +28,16 @@ func main() { meta.GitCommit = GitCommit meta.BuildDate = BuildDate + logrus.SetReportCaller(true) + logrus.SetFormatter(&logrus.TextFormatter{ + CallerPrettyfier: func(f *runtime.Frame) (function string, file string) { + fileName := fmt.Sprintf("%s:%d", path.Base(f.File), f.Line) + funcName := path.Base(f.Function) + return funcName, fileName + }, + FullTimestamp: true, + }) + a.Before = func(c *cli.Context) error { if c.GlobalBool("debug") { logrus.SetLevel(logrus.DebugLevel)