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

Request logging #597

Merged
merged 10 commits into from
Jun 19, 2024
Merged

Request logging #597

merged 10 commits into from
Jun 19, 2024

Conversation

GilianJuice
Copy link
Contributor

Describe your changes

Added middleware to log all requests. This will log everything from the request and the response, but some sensitive information will be redacted in the logs. This is turned off by default and needs to be turned on if you want to use it in a project. If enabled, a new table gcl_request_log will be automatically created, the logs will be stored there.

The middleware is made so that you can overwrite it in other projects to customize the logs. This will be used in Wiser to log requests that are done via it's API.

Type of change

Please check only ONE option.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How was this tested?

I have tested this by opening a test website and doing some requests and checking if my requests are being logged correctly. I have also tested this in the Wiser API to see if requests are logged correctly there too, after making customizations that are needed for Wiser. Wiser pull request will come later.

Checklist before requesting a review

  • I have reviewed and tested my changes
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I selected develop as the base branch and not main, or the pull request is a hotfix that needs to be done directly on main
  • I double checked all my changes and they contain no temporary test code, no code that is commented out and no changes that are not part of this branch
  • I added new unit tests for my changes if applicable

Related pull requests

N/A

Link to Asana ticket

https://app.asana.com/0/1205090868730163/1205939790117085

Copy link
Contributor

@HansHappyHorizon HansHappyHorizon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me, but there's a conflict that needs to be resolved first.

@GilianJuice GilianJuice force-pushed the feature/request-logging branch from 9f4cbc0 to 3bb124c Compare June 19, 2024 11:26
@GilianJuice
Copy link
Contributor Author

The changes look good to me, but there's a conflict that needs to be resolved first.

Merge conflict solved.

}
if (String.IsNullOrWhiteSpace(result))
{
result = GetHeaderValueAs<string>(httpContext, "X_FORWARDED_FOR"); // TransIP and other providers use this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the indentation here got a bit messed up after the rebase. Can you fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn't notice this. Is fixed now.

@HansHappyHorizon HansHappyHorizon merged commit 4e8edfa into develop Jun 19, 2024
3 checks passed
@HansHappyHorizon HansHappyHorizon deleted the feature/request-logging branch June 19, 2024 13:01
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