| 86 | } |
| 87 | |
| 88 | private formatMessage(level: Exclude<LoggerLevel, "none">, message: string): string { |
| 89 | const kind = LOGGER_LEVEL_FORMAT_TYPE_MAP[level]; |
| 90 | if (kind) { |
| 91 | // Format the message using the esbuild formatter. |
| 92 | // The first line of the message is the main `text`, |
| 93 | // subsequent lines are put into the `notes`. |
| 94 | const [firstLine, ...otherLines] = message.split("\n"); |
| 95 | const notes = otherLines.length > 0 ? otherLines.map((text) => ({ text })) : undefined; |
| 96 | return formatMessagesSync([{ text: firstLine, notes }], { |
| 97 | color: true, |
| 98 | kind, |
| 99 | terminalWidth: this.columns, |
| 100 | })[0]!; |
| 101 | } else { |
| 102 | return message; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /** |