Include response time in "request completed" log
IqbalLx opened this issue ยท 5 comments
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
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
@TommyDew42
Would this fit to the concept of this logger?
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
The timing information is easily adjusted by the user:
The standard response log has that info already