From be2da715c861c9e172847d9b12ce28e202533327 Mon Sep 17 00:00:00 2001 From: Mangirdas Date: Fri, 8 Sep 2023 10:32:18 +0300 Subject: [PATCH] Add path to understand client origin --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 4666271..c31e024 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,8 @@ import ( "net/http" "net/http/pprof" "os" + "path" + "runtime" "time" "github.com/bombsimon/logrusr/v4" @@ -55,6 +57,13 @@ func main() { logger := logrus.New() logger.SetLevel(logrus.Level(cfg.Log.Level)) + logger.SetReportCaller(true) + logger.Formatter = &logrus.TextFormatter{ + CallerPrettyfier: func(f *runtime.Frame) (string, string) { + filename := path.Base(f.File) + return fmt.Sprintf("%s()", f.Function), fmt.Sprintf("%s:%d", filename, f.Line) + }, + } client := castai.NewClient( logger,