Доработки логирования ошибок в дев-режиме

This commit is contained in:
Book Pauk
2019-01-04 16:28:44 +07:00
parent 8e0d52bc9d
commit 4379a9fa9f
2 changed files with 22 additions and 2 deletions

View File

@@ -15,6 +15,16 @@ function webpackDevMiddleware(app) {
app.use(hotMiddleware(compiler, {
log: log
}));
app.use(function(req, res, next) {
const start = Date.now();
const params = (req.body ? req.body.params : '');
log(`${req.method} ${req.originalUrl} ${req.body.params}`);
res.once('finish', () => {
log(`${Date.now() - start}ms`);
});
next();
});
}
module.exports = {