mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-21 01:32:03 +03:00
4334865266
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
26 lines
588 B
JavaScript
26 lines
588 B
JavaScript
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
const ms = require('ms')
|
|
|
|
let prevTime
|
|
|
|
module.exports = (banner) => {
|
|
return (msg) => {
|
|
const curr = +new Date()
|
|
const diff = curr - (prevTime || curr)
|
|
|
|
prevTime = curr
|
|
|
|
if (msg) {
|
|
console.log(
|
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
|
` ${String(banner)} ${msg} ${`+${ms(diff)}`}`
|
|
)
|
|
} else {
|
|
console.log()
|
|
}
|
|
}
|
|
}
|