-
Notifications
You must be signed in to change notification settings - Fork 800
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
Refactored and tested SerializeForLogging #6456
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
... and 28 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
} | ||
|
||
func (f *simpleRequestLogWrapper) SerializeForLogging() (string, error) { | ||
if f.request == nil || reflect.ValueOf(f.request).IsNil() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit inefficient, but this is a minor thing in comparison to the next json.Marshal, so should be fine to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I added a comment outlining this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
What changed?
Refactored SerializeForLogging so we use a wrapper instead of implementing it on every single request type. The function is used to give people implementing custum authorizers the ability to log the request body.
We supported nil receivers in the old interface, so to not break this support we here support typed nils.
Why?
Improve code quality and test coverage
How did you test it?
Potential risks
Release notes
Documentation Changes