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

feat: Add request logger middleware #32

Merged
merged 4 commits into from
Nov 18, 2021

Conversation

fzavalia
Copy link
Contributor

@fzavalia fzavalia commented Nov 18, 2021

Log all incoming requests displaying:

  • id: For tracing request and response
  • state: State of the request, REQUEST for when the request is received, SUCCESS when there is a successful response, FAILURE for the contrary, UNHANDLED_FAILURE when the request fails without being handled correctly and UNKOWN where there is a response without status code (I have no clue when that could happen but better safe than sorry)
  • code: Status code of the response
  • time: Time taken between the start of the request and the response
  • message: Currently used to display the error of >= 500 responses and UNHANDLED_FAILUREs
2021-11-18T17:03:13.083Z [INFO] (nft-server): http://localhost:5000/v1/nfts?foo=bar     {"id":1637254993083,"state":"REQUEST"}
2021-11-18T17:03:14.044Z [INFO] (nft-server): http://localhost:5000/v1/nfts?foo=bar     {"id":1637254993083,"state":"SUCCESS","code":200,"time":961}

@nachomazzara nachomazzara merged commit bb20c75 into master Nov 18, 2021
@nachomazzara nachomazzara deleted the feat/request-logger-middleware branch November 18, 2021 17:52
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