From 1d2c50fc26874dd9660aa72886d872552586bb76 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 7 Feb 2019 10:51:50 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88?= =?UTF-8?q?=E3=81=A7=E3=83=AD=E3=82=B0=E3=81=AE=E3=82=BF=E3=82=A4=E3=83=A0?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=B3=E3=83=97=E9=9D=9E=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/argv.ts | 1 + src/misc/logger.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/argv.ts b/src/argv.ts index af50d6a04..4914b89e2 100644 --- a/src/argv.ts +++ b/src/argv.ts @@ -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); diff --git a/src/misc/logger.ts b/src/misc/logger.ts index 7b669c3bb..b47529b3b 100644 --- a/src/misc/logger.ts +++ b/src/misc/logger.ts @@ -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); } }