From d12d201ef4023fe562624282ad3a6f78647fa4ce Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 14 Jul 2018 22:13:42 +0900 Subject: [PATCH] Update logger --- src/misc/logger.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/misc/logger.ts b/src/misc/logger.ts index 51c8adf037..04385251e4 100644 --- a/src/misc/logger.ts +++ b/src/misc/logger.ts @@ -21,32 +21,33 @@ export default class Logger { (new Logger('')).warn(message); } - public static info(message: string): void { - (new Logger('')).info(message); - } - public static succ(message: string): void { (new Logger('')).succ(message); } + public static info(message: string): void { + (new Logger('')).info(message); + } + public log(level: string, message: string) { const domain = this.domain.length > 0 ? `[${this.domain}] ` : ''; Logger.log(level, `${domain}${message}`); } - public error(message: string): void { + public error(message: string): void { // 実行を継続できない状況で使う this.log(chalk.red.bold('ERROR'), chalk.red.bold(message)); } - public warn(message: string): void { + public warn(message: string): void { // 実行を継続できるが改善すべき状況で使う this.log(chalk.yellow.bold('WARN'), chalk.yellow.bold(message)); } - public info(message: string): void { + public succ(message: string): void { // 何かに成功した状況で使う + this.log(chalk.blue.bold('INFO'), chalk.green.bold(message)); + } + + public info(message: string): void { // それ以外 this.log(chalk.blue.bold('INFO'), message); } - public succ(message: string): void { - this.log(chalk.blue.bold('INFO'), chalk.green.bold(message)); - } }