From fb914db1aace3b2886fb66a548412c337ca46d19 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 4 Feb 2022 10:41:27 +0900 Subject: [PATCH] use date-fns --- packages/backend/src/services/logger.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 626cc6b44..1962088b6 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -1,6 +1,6 @@ import * as cluster from 'cluster'; import * as chalk from 'chalk'; -import * as dateformat from 'dateformat'; +import { format as dateFormat } from 'date-fns'; import { envOption } from '../env'; import config from '@/config/index'; @@ -57,7 +57,7 @@ export default class Logger { return; } - const time = dateformat(new Date(), 'HH:MM:ss'); + const time = dateFormat(new Date(), 'HH:mm:ss'); const worker = cluster.isPrimary ? '*' : cluster.worker.id; const l = level === 'error' ? important ? chalk.bgRed.white('ERR ') : chalk.red('ERR ') : @@ -116,7 +116,7 @@ export default class Logger { } public debug(message: string, data?: Record | null, important = false): void { // デバッグ用に使う(開発者に必要だが利用者に不要な情報) - if (process.env.NODE_ENV != 'production' || envOption.verbose) { + if (process.env.NODE_ENV !== 'production' || envOption.verbose) { this.log('debug', message, data, important); } }