Better logging
This commit is contained in:
@ -31,19 +31,24 @@ export default class Logger {
|
||||
}
|
||||
|
||||
public error(message: string | Error): void { // 実行を継続できない状況で使う
|
||||
this.log(chalk.red.bold('ERROR'), chalk.red.bold(message.toString()));
|
||||
this.log(chalk.red('ERR '), chalk.red(message.toString()));
|
||||
}
|
||||
|
||||
public warn(message: string, important = false): void { // 実行を継続できるが改善すべき状況で使う
|
||||
this.log(chalk.yellow.bold('WARN'), chalk.yellow.bold(message), important);
|
||||
this.log(chalk.yellow('WARN'), chalk.yellow(message), important);
|
||||
}
|
||||
|
||||
public succ(message: string, important = false): void { // 何かに成功した状況で使う
|
||||
this.log(chalk.blue.green('DONE'), chalk.green.bold(message), important);
|
||||
this.log(chalk.green('DONE'), chalk.green(message), important);
|
||||
}
|
||||
|
||||
public info(message: string, important = false): void { // それ以外
|
||||
this.log(chalk.blue.bold('INFO'), message, important);
|
||||
this.log(chalk.blue('INFO'), message, important);
|
||||
}
|
||||
|
||||
public debug(message: string, important = false): void { // デバッグ用に使う
|
||||
if (process.env.NODE_ENV != 'production') {
|
||||
this.log(chalk.gray('VERB'), chalk.gray(message), important);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user