aroma.js
Version:
A lightweight, feature-rich, and developer-friendly web framework to build modern applications with ease.
13 lines (11 loc) • 372 B
JavaScript
function logger(app) {
app.use((req, res, next) => {
const startTime = Date.now();
res.on('finish', () => {
const duration = Date.now() - startTime;
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url} ${res.statusCode} ${duration}ms`);
});
next();
});
}
module.exports = logger;