Update logger

This commit is contained in:
Aya Morisawa 2018-07-14 22:13:42 +09:00
parent c91a4c9da1
commit d12d201ef4
1 changed files with 11 additions and 10 deletions

View File

@ -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));
}
}