デフォルトでログのタイムスタンプ非表示

This commit is contained in:
syuilo 2019-02-07 10:51:50 +09:00
parent cef8aa5e7a
commit 1d2c50fc26
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 3 additions and 1 deletions

View File

@ -10,6 +10,7 @@ program
.option('--only-queue', 'Pocessing job queue only')
.option('--quiet', 'Suppress all logs')
.option('--verbose', 'Enable all logs')
.option('--with-log-time', 'Include timestamp for each logs')
.option('--slow', 'Delay all requests (for debbuging)')
.option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.')
.parse(process.argv);

View File

@ -28,7 +28,8 @@ export default class Logger {
} else {
const time = dateformat(new Date(), 'HH:MM:ss');
const process = cluster.isMaster ? '*' : cluster.worker.id;
const log = `${chalk.gray(time)} ${level} ${process}\t[${domains.join(' ')}]\t${message}`;
let log = `${level} ${process}\t[${domains.join(' ')}]\t${message}`;
if (program.withLogTime) log = chalk.gray(time) + ' ' + log;
console.log(important ? chalk.bold(log) : log);
}
}