1

I am logging the every server call details in plaintext file using node.js and express in the extended log format, For this i need to find out the length of time that the action took(http get or post).

How to find out the time taken for the particular request?

Any idea will be greatful.

1 Answer 1

2

If you are using the express.logger() middleware, you can easily add a :response-time token. See http://www.senchalabs.org/connect/middleware-logger.html for documentation.

Otherwise, use the responseTime middleware and do something like

 console.log(res.getHeader("X-Response-Time")) 

in your own middleware.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.