| 105 | } |
| 106 | |
| 107 | function logBullet( |
| 108 | logger: typeof log | typeof logError, |
| 109 | colorizePrefix: (v: string) => string, |
| 110 | colorizeText: (v: string) => string, |
| 111 | symbol: string, |
| 112 | prefix: string, |
| 113 | text?: string | string[], |
| 114 | ) { |
| 115 | let textParts = Array.isArray(text) ? text : [text || ""].filter(Boolean); |
| 116 | let formattedText = textParts |
| 117 | .map((textPart) => colorizeText(textPart)) |
| 118 | .join(""); |
| 119 | |
| 120 | if (process.stdout.columns < 80) { |
| 121 | logger( |
| 122 | `${" ".repeat(5)} ${colorizePrefix(symbol)} ${colorizePrefix(prefix)}`, |
| 123 | ); |
| 124 | logger(`${" ".repeat(9)}${formattedText}`); |
| 125 | } else { |
| 126 | logger( |
| 127 | `${" ".repeat(5)} ${colorizePrefix(symbol)} ${colorizePrefix( |
| 128 | prefix, |
| 129 | )} ${formattedText}`, |
| 130 | ); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | export function debug(prefix: string, text?: string | string[]) { |
| 135 | logBullet(log, color.yellow, color.dim, "●", prefix, text); |