Skip to content

add Requests logger#9

Merged
LbP22 merged 8 commits intodevforth:mainfrom
panz3r:main
Aug 1, 2023
Merged

add Requests logger#9
LbP22 merged 8 commits intodevforth:mainfrom
panz3r:main

Conversation

@panz3r
Copy link
Copy Markdown
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
Copy Markdown
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
@LbP22
Copy link
Copy Markdown
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