UNPKG

i18n-auto-react

Version:

基于百度翻译API服务的自动翻译插件

23 lines (20 loc) 544 B
import chalk from 'chalk'; class Logger { info(msg, color = 'blue', isBold = false) { if (isBold) { console.log(chalk[color].bold(msg)); } else { console.log(chalk[color](msg)); } } warning(msg) { console.log(chalk.yellow(`${chalk.bold('Warning: ')}${msg}`)); } error(msg) { msg = msg instanceof Error ? msg.message : msg; console.log(chalk.red(`${chalk.bold('Error: ')}${msg}`)); } } const logger = new Logger(); export { logger as l };