(quiet = false)
| 15 | } |
| 16 | |
| 17 | export function create(quiet = false) { |
| 18 | const s = p.spinner(); |
| 19 | return { |
| 20 | docs(url: string) { |
| 21 | if (!quiet) console.log(chalk.dim(`Docs: ${url}`)); |
| 22 | }, |
| 23 | start(msg: string) { |
| 24 | if (!quiet) s.start(msg); |
| 25 | }, |
| 26 | stop(ms: number) { |
| 27 | if (!quiet) s.stop(`Done in ${elapsed(ms)}`); |
| 28 | }, |
| 29 | poll(status: string) { |
| 30 | if (!quiet) s.message(`Status: ${status}`); |
| 31 | }, |
| 32 | result(data: unknown) { |
| 33 | if (quiet) console.log(JSON.stringify(data)); |
| 34 | else console.log(`\n${highlight(JSON.stringify(data, null, 2))}\n`); |
| 35 | }, |
| 36 | error(message?: string): never { |
| 37 | p.log.error(message ?? "Unknown error"); |
| 38 | process.exit(1); |
| 39 | }, |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | export type Logger = ReturnType<typeof create>; |
nothing calls this directly
no outgoing calls
no test coverage detected