From 75558add17a14142d51205f20a2f535fc91f3a34 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 3 Feb 2019 16:45:13 +0900 Subject: Better logging --- src/misc/logger.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/misc') diff --git a/src/misc/logger.ts b/src/misc/logger.ts index 5440edab74..8fbff9638d 100644 --- a/src/misc/logger.ts +++ b/src/misc/logger.ts @@ -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); + } + } } -- cgit v1.2.3-freya