| 15 | const REVERSED_RED = '\u001b[91;7m'; |
| 16 | const BLUE = '\u001b[34;1m'; |
| 17 | // const BRIGHT_BLUE = '\u001b[94;1m'; |
| 18 | const YELLOW = '\u001b[33;0m'; |
| 19 | // const DIM_YELLOW = '\u001b[33;2m'; |
| 20 | |
| 21 | // const GREY_BG = '\u001b[40;1m'; |
| 22 | |
| 23 | function simpleFormatter(type: LogType, ...message: LogMessage[]): string { |
| 24 | const CONSOLE_INDENT = ' '; |
| 25 | |
| 26 | let s = message.map((x) => x.toString()).join(''); |
| 27 | |
| 28 | if (type === 'assert') |
| 29 | s = |
| 30 | '\n' + |
| 31 | REVERSED_RED + |
| 32 | ' ASSERTION FAILURE ' + |
| 33 | RESET + |
| 34 | RED + |
| 35 | ' ' + |
| 36 | message + |
| 37 | RESET; |
| 38 | else if (type === 'error') |
| 39 | s = REVERSED_RED + ' ERROR ' + RESET + RED + ' ' + message + RESET; |
| 40 | else if (type === 'log') s = BLUE + message + RESET; |
| 41 | else if (type === 'warn') s = YELLOW + 'WARNING ' + YELLOW + message + RESET; |
| 42 | |
| 43 | if (!process.stderr.isTTY || process.env.NO_COLOR !== undefined) |
| 44 | s = stripVTControlCharacters(s); |