Skip to content
Snippets Groups Projects
Commit e1b77aed authored by andree.klattenhoff's avatar andree.klattenhoff
Browse files

Use reply.elapsedTime to log response time

parent 8926d58e
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ export default async function (app, opts) { ...@@ -42,7 +42,7 @@ export default async function (app, opts) {
// Logs the request with the 'debug' level and also logs headers with the 'trace' level // Logs the request with the 'debug' level and also logs headers with the 'trace' level
app.addHook('onResponse', (req, reply, done) => { app.addHook('onResponse', (req, reply, done) => {
const responseTime = reply.getResponseTime() const responseTime = reply.elapsedTime
const loggingOptions = { url: req.raw.url, res: reply, method: req.method, responseTime } const loggingOptions = { url: req.raw.url, res: reply, method: req.method, responseTime }
/* c8 ignore next */ /* c8 ignore next */
if (process.env.LOG_LEVEL === 'trace') loggingOptions.headers = req.headers if (process.env.LOG_LEVEL === 'trace') loggingOptions.headers = req.headers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment