UNPKG

@digipolis/start-ui

Version:
29 lines (23 loc) 680 B
import chalk from 'chalk'; const { log } = console; export function fancyLog(color, text, sign = '-') { const stringLength = text.length + 2; const beforeAfterLength = 14; const totalLength = stringLength + 2 * beforeAfterLength; log(chalk`${sign.repeat(totalLength)}`); log(chalk`${sign.repeat(beforeAfterLength)} {${color} ${text}} ${sign.repeat(beforeAfterLength)}`); log(chalk`${sign.repeat(totalLength)}`); } export function updateLog(text, color = 'green') { log(chalk` {${color}.bold ${text}}`); } export function errorLog(error) { log(chalk.bold.red('Oops!')); log(chalk.red(error.stack)); } export default { fancyLog, updateLog, errorLog, };