When SetReportCaller is true, the log has the full file path (starting at root) and then also the method name as below
INFO[2018-11-19 10:15:34]/Users/anoop/goworkspace/src/go-sample-app/pack/some_doer.go:22 go-sample-app/pack.DoSomething() Doing something
Is it possible to restrict the file name to start only from the application's root directory and not print the method name? Below is an example of what I am looking for.
INFO[2018-11-19 10:15:34]go-sample-app/pack/some_doer.go:22 Doing something
At this time the current implementation does not provide a way to configure the length of the path to use in the output.
You can partially get rid of the path by passing trimpath flags to go build:
go build \
-gcflags="all=-trimpath=${GOPATH}" \
-asmflags "all=-trimpath=${GOPATH}" \
./...
duplicate of #887
Most helpful comment
You can partially get rid of the path by passing trimpath flags to go build: