Profiler don't log times if there is no one task done at least

This commit is contained in:
Daniel García Aubert 2020-06-19 11:42:46 +02:00
parent 22086ba914
commit 6cddec562a

View File

@ -16,9 +16,10 @@ module.exports = function profiler (options) {
profile: enabled
});
req.profiler.start([prefix, 'response'].join('.'));
req.profiler.start(prefix);
res.on('finish', () => {
req.profiler.done('response');
req.profiler.end();
logger.info({ stats: req.profiler.toJSON() });