2021-04-11 01:09:09 +03:00
|
|
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-02-10 22:45:41 +03:00
|
|
|
const ms = require('ms')
|
2019-12-24 15:40:03 +03:00
|
|
|
|
2022-02-10 22:45:41 +03:00
|
|
|
let prevTime
|
2019-12-24 15:40:03 +03:00
|
|
|
|
2022-02-10 22:45:41 +03:00
|
|
|
module.exports = (banner) => {
|
|
|
|
return (msg) => {
|
2019-12-24 15:40:03 +03:00
|
|
|
const curr = +new Date()
|
|
|
|
const diff = curr - (prevTime || curr)
|
|
|
|
|
|
|
|
prevTime = curr
|
|
|
|
|
|
|
|
if (msg) {
|
|
|
|
console.log(
|
2020-05-30 02:48:57 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
2022-02-10 22:45:41 +03:00
|
|
|
` ${String(banner)} ${msg} ${`+${ms(diff)}`}`
|
2019-12-24 15:40:03 +03:00
|
|
|
)
|
|
|
|
} else {
|
|
|
|
console.log()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|