Jacky Zhao
2023-07-16 a3e4c86a4cf18e31fe5b65d57ce120174c9f6aee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()
    }
  }
 
  success(text: string) {
    if (!this.verbose) {
      this.spinner!.stop(true)
    }
    console.log(text)
  }
}