2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 20:30:25 +00:00
books/webpack/logger.js
Faris Ansari ddd9a786d2 Frappe CLI for development
- frappe start command
  - starts frappejs server
  - sets up webpack middleware to bundle files
- introduce frappe.conf.js for configuration
2018-07-29 16:51:03 +05:30

20 lines
438 B
JavaScript

const ms = require('ms');
const chalk = require('chalk');
let prevTime;
module.exports = function (banner, color = 'green') {
return function (message) {
const currentTime = +new Date();
const diff = currentTime - (prevTime || currentTime);
prevTime = currentTime;
if (message) {
console.log(` ${chalk[color](banner)} ${message} ${chalk.green(`+${ms(diff)}`)}`)
}
else {
console.log()
}
}
}