tauri/mode/helpers/logger.js
Lucas Fernandes Nogueira 9981da93ed chore(mode) cleanup (#23)
* feat(mode) cleanup

* fix(cli) fix bin entry
2019-08-21 23:35:51 +02:00

22 lines
391 B
JavaScript

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