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

Add request meta data when logging request error. #41

Conversation

emidander
Copy link

This PR adds the same request data (path, query etc) that is added to the normal request log to the one written when a request has errors. This is helpful for applications wishing to see what endpoint logged an error - for example by returning 400.

if len(c.Errors) > 0 {
// Append error field if this is an erroneous request.
for _, e := range c.Errors.Errors() {
logger.Error(e)
logger.Error(e, fields...)

Check failure

Code scanning / CodeQL

Log entries created from user input

This log write receives unsanitized user input from [here](1). This log write receives unsanitized user input from [here](2). This log write receives unsanitized user input from [here](3). This log write receives unsanitized user input from [here](4).
@appleboy appleboy closed this in 30de6b1 Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants