Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limiting the information printed when SetReportCaller is true #865

Closed
anoop-nair opened this issue Nov 19, 2018 · 4 comments
Closed

Limiting the information printed when SetReportCaller is true #865

anoop-nair opened this issue Nov 19, 2018 · 4 comments

Comments

@anoop-nair
Copy link

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

@dgsb
Copy link
Collaborator

dgsb commented Nov 22, 2018

At this time the current implementation does not provide a way to configure the length of the path to use in the output.

@cacheflux
Copy link

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}" \
	./...

@dgsb
Copy link
Collaborator

dgsb commented Feb 10, 2019

duplicate of #887

@dgsb dgsb closed this as completed Feb 10, 2019
@LHRchina
Copy link

LHRchina commented Aug 5, 2021

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}" \
	./...

how about the func segment . it is also the relative the GOPATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants