-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add full file path to error logs that contain a stack #65
Comments
Hi @akajla09 I would like to contribute on this. |
Hi @AKARSHITJOSHI - thanks for offering to help. I haven't looked into this deeply so can't say for certain if this change will work. Have you tried it locally and tested it out? If you have a sample log output from the change, we can look at it to see if it contains the full filepath. |
Can you submit a PR for this change? Looks like it does add the caller to error messages which is nice. However, I'm curious if it'll work for errors that are wrapped via |
Is your feature request related to a problem? Please describe.
Warrant uses zerolog for structured logging (with stack enabled) to make debugging errors easier. Currently, zerolog only prints the filename (e.g.
sqlite.go
orrepository.go
) in the stack without the full file path which makes it difficult to quickly figure out which pkg the file belongs to, given that multiple Warrant packages have similar filenames (repository.go
etc). For example, it's hard to tell at a first glance from the following log whichsqlite.go
repository is causing an error:Describe the solution you'd like
There should be a configuration in zerolog to add the full path of the filename (including pkg subdir) so we can print
/authz/object/sqlite.go
vs.sqlite.go
in the logs.Note: depending on implementation and computational complexity, we might want to make this setting configurable so users can disable in prod if desired.
Additional context
https://github.com/rs/zerolog#add-file-and-line-number-to-log
The text was updated successfully, but these errors were encountered: