wiki/quartz/log.ts

27 lines
509 B
TypeScript
Raw Normal View History

2023-07-23 00:27:41 +00:00
import { Spinner } from "cli-spinner"
2023-06-04 17:37:43 +00:00
export class QuartzLogger {
verbose: boolean
spinner: Spinner | undefined
constructor(verbose: boolean) {
this.verbose = verbose
}
start(text: string) {
if (this.verbose) {
console.log(text)
} else {
this.spinner = new Spinner(`%s ${text}`)
this.spinner.setSpinnerString(18)
this.spinner.start()
}
}
success(text: string) {
if (!this.verbose) {
this.spinner!.stop(true)
}
console.log(text)
}
}