로그 파일에서 query 결과가 잘려보이는 오류 수정 (3), 로그 시간 오류 수정

This commit is contained in:
2026-07-04 17:58:58 +09:00
parent 7e2f629681
commit 8269eee996
3 changed files with 26 additions and 4 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import { PrismaMariaDb } from "@prisma/adapter-mariadb";
import { format } from "sql-formatter";
import { PrismaClient, Prisma } from "@/lib/generated/prisma/client";
import { logger } from "@/lib/logger";
import { logger, timestamp } from "@/lib/logger";
const globalForPrisma = globalThis as unknown as {
prisma?: PrismaClient;
@@ -54,7 +54,7 @@ function onQuery(e: Prisma.QueryEvent): void {
const sqlToFormat = isSensitive ? e.query : inlineParams(e.query, e.params);
const formatted = format(sqlToFormat, { language: "mysql", tabWidth: 2 });
const ts = new Date().toISOString();
const ts = timestamp();
const tag = level.toUpperCase().padEnd(5);
const slowLabel = isSlow ? " [SLOW]" : "";
const header = `[${ts}] [${tag}] [db:query] ${e.duration}ms${slowLabel}`;
@@ -209,7 +209,7 @@ function logResult(
result: unknown
): void {
if (!logger.isEnabled("debug")) return;
const ts = new Date().toISOString();
const ts = timestamp();
const body = buildResultLog(model, operation, result);
writeAll(1, `[${ts}] [DEBUG] [db:result] ${body}\n`);
}