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

Wrong line reported #6

Closed
robfig opened this issue Aug 8, 2019 · 2 comments · Fixed by #10
Closed

Wrong line reported #6

robfig opened this issue Aug 8, 2019 · 2 comments · Fixed by #10

Comments

@robfig
Copy link

robfig commented Aug 8, 2019

Running the example program from the README prints this line:

2019-08-08T11:36:25.528-0400	INFO	zapr/zapr.go:69	Logr in action!	{"the answer": 42}

I would expect it to print the file and line of the program, rather than a line within zapr.go.

@abursavich
Copy link

Yep, I was coming here to file the same issue. Zapr changes the call stack, but doesn't use the AddCallerSkip option to adjust the frames to the caller.

Example: https://play.golang.org/p/VdTPtGsGXSC

naemono added a commit to naemono/zapr that referenced this issue Oct 21, 2019
Use zap.AddCallerSkip to refer to the correct line caller reference/file:linenum
naemono added a commit to naemono/zapr that referenced this issue Oct 21, 2019
DirectXMan12 pushed a commit that referenced this issue Nov 5, 2019
Use zap.AddCallerSkip to refer to the correct line caller reference/file:linenum
@dan-j dan-j mentioned this issue Dec 19, 2019
@ralf-cestusio
Copy link

This does fix it for the exact bug reportet, but does break again when using WithName or WithValues since those are not supposed to add an additional skip .

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

Successfully merging a pull request may close this issue.

3 participants