summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-02-03 21:42:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-02-03 21:42:52 +0900
commitb4859be098d0752c1517466ee102c7606397d21f (patch)
tree7fbacf47e0bb1da9416858de5350b4e6be397419 /src/misc
parentFix type declaretion (diff)
downloadmisskey-b4859be098d0752c1517466ee102c7606397d21f.tar.gz
misskey-b4859be098d0752c1517466ee102c7606397d21f.tar.bz2
misskey-b4859be098d0752c1517466ee102c7606397d21f.zip
Improve log readability
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/logger.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/misc/logger.ts b/src/misc/logger.ts
index f8f7aa7324..0cf6b72a6d 100644
--- a/src/misc/logger.ts
+++ b/src/misc/logger.ts
@@ -19,15 +19,16 @@ export default class Logger {
return logger;
}
- public log(level: string, message: string, important = false): void {
+ public log(level: string, message: string, important = false, subDomains: string[] = []): void {
if (program.quiet) return;
const domain = this.color ? chalk.keyword(this.color)(this.domain) : chalk.white(this.domain);
+ const domains = [domain].concat(subDomains);
if (this.parentLogger) {
- this.parentLogger.log(level, `[${domain}]\t${message}`, important);
+ this.parentLogger.log(level, message, important, domains);
} else {
const time = dateformat(new Date(), 'HH:MM:ss');
const process = cluster.isMaster ? '*' : cluster.worker.id;
- const log = `${chalk.gray(time)} ${level} ${process}\t[${domain}]\t${message}`;
+ const log = `${chalk.gray(time)} ${level} ${process}\t[${domains.join(' ')}]\t${message}`;
console.log(important ? chalk.bold(log) : log);
}
}