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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include response time in "request completed" log #11

Open
2 tasks done
IqbalLx opened this issue Dec 27, 2022 · 5 comments
Open
2 tasks done

Include response time in "request completed" log #11

IqbalLx opened this issue Dec 27, 2022 · 5 comments

Comments

@IqbalLx
Copy link

IqbalLx commented Dec 27, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

馃殌 Feature Proposal

Hi! I think it will be better if the completed request log also included the original response time. Maybe something like this 2017-02-14 20:51:48.000+0800 - info - completed in 0.14731597900390625 seconds - request completed

I've been trying to implement this simple feature by myself, but I am not sure how to write test for this response time? Any recommendations maybe, so that I can open PR for this issue.

Thanks

Motivation

No response

Example

No response

@Eomm
Copy link
Member

Eomm commented Dec 27, 2022

I've been trying to implement this simple feature by myself, but I am not sure how to write test for this response time? Any recommendations maybe, so that I can open PR for this issue.

You need to use some fake timers for it such as sinon

What about this format instead?

2017-02-14 20:51:48.000+0800 - info - request completed in 147 ms

@Uzlopak
Copy link
Contributor

Uzlopak commented Dec 27, 2022

@TommyDew42
Would this fit to the concept of this logger?

@TommyDew42
Copy link
Contributor

TommyDew42 commented Dec 27, 2022

The initial idea (fastify/fastify#4027) was simple and just to provide a better looking log to developers. I guess it's alright to add the response time if users find it useful? @mcollina

@jsumners
Copy link
Member

@Eomm
Copy link
Member

Eomm commented Dec 28, 2022

The standard response log has that info already

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

No branches or pull requests

5 participants