mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-24 04:26:22 +00:00
28 lines
530 B
TypeScript
28 lines
530 B
TypeScript
import { Spinner } from "cli-spinner"
|
|
|
|
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()
|
|
}
|
|
}
|
|
|
|
end(text?: string) {
|
|
if (!this.verbose) {
|
|
this.spinner!.stop(true)
|
|
}
|
|
if (text) {
|
|
console.log(text)
|
|
}
|
|
}
|
|
}
|