-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
I'm using a wrapper for the logrus library to add file/line and just as an internal abstraction for the logging library.
After starting to use the wrapper, I'm seeing that when an error is logged by library code, the culprit is identified as a frame in the log wrapper, because I have the InAppPrefix set to the top-level package path for my project.
I think an example serves best here:
github.com/myproject/
myapp/
main.go
mylib/
foo.go <= This logs an exception
logwrapper/
wrapper.go
- If
foo.gologs an error, and I haveInAppPrefixset togithub.com/myproject, the culprit is the relevant log methodlogwrapper/wrapper.go. - If
foo.gologs an error, and I haveInAppPrefixset togithub.com/myproject/myapp, the culprit is the relevant log method inlogrus(I'm not seeing any client code setting culprit here, so I guess the server is picking it, and none of the packages in the stacktrace belong to the InAppPrefix).
I can't just set Skip to the right number on the StackTraceConfiguration, because Errorf and Error differ by 1 stack frame, since Errorf calls Error
Do you have any thoughts on how to get the culprit become the line that logs in foo.go? The options that I see are:
- Adding an option to
StackTraceConfigurationforExcludeFromStacktraceprefixes - Adding an option to
StackTraceConfigurationfor a customStackTracerinterface that provides the stacktrace external tologrus_sentry. We don't usepkg.Errorso we don't really benefit from all that logic.
Metadata
Metadata
Assignees
Labels
No labels