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 Requests logger #9

Merged
merged 8 commits into from
Aug 1, 2023
Merged

add Requests logger #9

merged 8 commits into from
Aug 1, 2023

Conversation

panz3r
Copy link
Contributor

@panz3r panz3r commented Jul 16, 2023

This PR adds a Requests logger handler to the main http.Handler that can be enabled using a new logger option.

The logger handler implementation is based upon rs/zerolog logging library and supports printing log events as either JSON or pretty text (enabled via another option: log-pretty).

Example JSON log output

{
  "level": "info",
  "method": "GET",
  "path": "/",
  "code": 200,
  "size": 449,
  "duration": 4.654542,
  "ipAddress": "127.0.0.1",
  "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0",
  "referer": "",
  "time": "2023-07-06T12:34:56+00:00"
}

@ivictbor
Copy link
Contributor

@panz3r looks awesome! @MultiFox200 @LbP22 could you please someone take a look and merge once you have a time?

@MultiFox200 MultiFox200 self-requested a review July 26, 2023 07:40
@MultiFox200 MultiFox200 requested a review from LbP22 July 26, 2023 07:41
@LbP22 LbP22 merged commit 608e209 into devforth:main Aug 1, 2023
1 check passed
@LbP22
Copy link
Contributor

LbP22 commented Aug 1, 2023

Thanks for your work! Your changes released as version 1.0.5!

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.

4 participants