diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-07-14 22:13:42 +0900 |
|---|---|---|
| committer | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-07-14 22:14:56 +0900 |
| commit | d12d201ef4023fe562624282ad3a6f78647fa4ce (patch) | |
| tree | 10f0f64e622d66ff9194dc3f9cbe1b01fe211939 /src/misc | |
| parent | Update log messages (diff) | |
| download | sharkey-d12d201ef4023fe562624282ad3a6f78647fa4ce.tar.gz sharkey-d12d201ef4023fe562624282ad3a6f78647fa4ce.tar.bz2 sharkey-d12d201ef4023fe562624282ad3a6f78647fa4ce.zip | |
Update logger
Diffstat (limited to 'src/misc')
| -rw-r--r-- | src/misc/logger.ts | 21 |
1 files 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 { - this.log(chalk.blue.bold('INFO'), message); + public succ(message: string): void { // 何かに成功した状況で使う + this.log(chalk.blue.bold('INFO'), chalk.green.bold(message)); } - 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); } + } |