From c0352352ea5202a9818fda80ee9c872bc8ae72d7 Mon Sep 17 00:00:00 2001 From: scarf Date: Sun, 22 Dec 2024 15:01:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B1=B0=20=EB=82=A0=EC=A7=9C?= =?UTF-8?q?=20=ED=98=95=EC=8B=9D=20=EC=A0=95=EC=83=81=ED=99=94=20(#82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/SaneLogger.ts | 9 +++++++++ backend/src/main.ts | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 backend/src/SaneLogger.ts diff --git a/backend/src/SaneLogger.ts b/backend/src/SaneLogger.ts new file mode 100644 index 0000000..6a84c95 --- /dev/null +++ b/backend/src/SaneLogger.ts @@ -0,0 +1,9 @@ +import { ConsoleLogger, LoggerService } from '@nestjs/common'; + +export class SaneLogger extends ConsoleLogger implements LoggerService { + protected override getTimestamp() { + return new Date() + .toISOString() + .replace(/(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}).*/g, '$1 $2'); + } +} diff --git a/backend/src/main.ts b/backend/src/main.ts index 450145d..ce07a49 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -2,9 +2,12 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { patchNestjsSwagger } from '@anatine/zod-nestjs'; +import { SaneLogger } from './SaneLogger'; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(AppModule, { + logger: new SaneLogger(), + }); const config = new DocumentBuilder() .setTitle('집현전 백엔드 6차')