forked from FoundKeyGang/FoundKey
デフォルトでログのタイムスタンプ非表示
This commit is contained in:
parent
cef8aa5e7a
commit
1d2c50fc26
2 changed files with 3 additions and 1 deletions
|
@ -10,6 +10,7 @@ program
|
||||||
.option('--only-queue', 'Pocessing job queue only')
|
.option('--only-queue', 'Pocessing job queue only')
|
||||||
.option('--quiet', 'Suppress all logs')
|
.option('--quiet', 'Suppress all logs')
|
||||||
.option('--verbose', 'Enable all logs')
|
.option('--verbose', 'Enable all logs')
|
||||||
|
.option('--with-log-time', 'Include timestamp for each logs')
|
||||||
.option('--slow', 'Delay all requests (for debbuging)')
|
.option('--slow', 'Delay all requests (for debbuging)')
|
||||||
.option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.')
|
.option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
|
@ -28,7 +28,8 @@ export default class Logger {
|
||||||
} else {
|
} else {
|
||||||
const time = dateformat(new Date(), 'HH:MM:ss');
|
const time = dateformat(new Date(), 'HH:MM:ss');
|
||||||
const process = cluster.isMaster ? '*' : cluster.worker.id;
|
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);
|
console.log(important ? chalk.bold(log) : log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue