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

Logrushook didn't log the actual caller #134

Open
tiagralee opened this issue Jun 22, 2020 · 2 comments
Open

Logrushook didn't log the actual caller #134

tiagralee opened this issue Jun 22, 2020 · 2 comments
Labels
P2 Low priority

Comments

@tiagralee
Copy link
Contributor

If logrus is passed to the serverparams in server.go, the pkg logger is become a proxy and log all the log to logrus via the logrushook.
The issue is that if we set the reportCaller, the result is not correct as the detected caller is from the hook in logging.go. Below is an example result:
image

The expected result is from the place pkg logger is called, like.
image

@andrewemeryanz andrewemeryanz added the P1 Medium priority label Jun 23, 2020
@andrewemeryanz
Copy link
Contributor

The issue affects logs logged against the pkg logger directly (i.e. logs logged from within sysl-go itself). The issue is that logrus overwrites the caller directly in the logrus.Entry.log method, making it impossible to set a custom value beforehand. This change cannot be cleanly[1] supported without a logrus change.

[1] A workaround would be to SetReportCaller to false before calling logrus.Entry.log then setting it to true afterwards but the logrus logger is mutable which would result in inconsistent logging through multiple threads.

@andrewemeryanz
Copy link
Contributor

I'm going to deprioritise this. The caller is logged as an attribute so the information isn't lost, just not consistent with logs logged directly against logrus.

@andrewemeryanz andrewemeryanz added P2 Low priority and removed P1 Medium priority labels Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Low priority
Projects
None yet
Development

No branches or pull requests

2 participants