mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-19 08:31:35 +03:00
22 lines
391 B
JavaScript
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()
|
||
|
}
|
||
|
}
|
||
|
}
|