-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Trace Support #284
Trace Support #284
Conversation
Dd context
Hrmm, strange CI output :/ |
Trace ends up looking like this:
|
Can someone re-run this for me? Looks like a Github error. |
Thanks a lot for following up @derekdowling Do you personally have a use-case where you only want it on some calls? Why did you chose to implement it like this instead of as a middleware? |
In general I think people want stack traces when they're debugging, enough so that it should be a core feature in the logger since if you're print debugging, one typically accompanies the other. I realize that the core goal of Logrus is to be an intelligent log formatter, but typically people also use that log formatter as part of the debugging process. Furthermore, as I mentioned in the other PR. It's really hard to get a consistent caller field saying exactly when and where Logrus was called since there are so many entry points into the library. This is a good compromise that will allow those who want to know, where exactly a log statement is coming from. As part of the criteria, I've turned the functionality off by default to avoid an efficiency penalties that would otherwise occur. |
Any news on this? Builtin stack trace support would be great. |
Closing since CI is failing and there's no activity. Feel free to reopen. |
Hello, alooooong time ago I opened #75. I've pulled out the Trace logic and have taken suggestions from the various comments. What I've come up with is a
WithTrace()
fluent call similar toWithField()/WithError()
.If specified, the trace will be included, otherwise it will not be computed. I've looked a lot into figuring out caller/line numbers but because there are so many variations and entry points into the API as I mentioned in the other PR, it is extremely difficult to come up with an elegant way to handle that.
I'm hoping with the smaller, more isolated PR, we can get at least this Trace logic in which will work in a bind for those who want more context as to where errors are occurring and where they are being logged from.