| 38 | |
| 39 | /** Logs a header within a text drawn box. */ |
| 40 | export function logHeader(...params: string[]) { |
| 41 | const totalWidth = 80; |
| 42 | const fillWidth = totalWidth - 2; |
| 43 | const headerText = params.join(' ').substr(0, fillWidth); |
| 44 | const leftSpace = Math.ceil((fillWidth - headerText.length) / 2); |
| 45 | const rightSpace = fillWidth - leftSpace - headerText.length; |
| 46 | const fill = (count: number, content: string) => content.repeat(count); |
| 47 | |
| 48 | Log.info(`┌${fill(fillWidth, '─')}┐`); |
| 49 | Log.info(`│${fill(leftSpace, ' ')}${headerText}${fill(rightSpace, ' ')}│`); |
| 50 | Log.info(`└${fill(fillWidth, '─')}┘`); |
| 51 | } |