로그 파일에서 query 결과가 잘려보이는 오류 수정
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { writeSync } from "fs";
|
||||
|
||||
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
||||
import { format } from "sql-formatter";
|
||||
|
||||
@@ -46,12 +48,8 @@ function onQuery(e: Prisma.QueryEvent): void {
|
||||
.map((l) => ` ${l}`)
|
||||
.join("\n");
|
||||
|
||||
const out = `${header}\n${indented}`;
|
||||
if (isSlow) {
|
||||
console.error(out);
|
||||
} else {
|
||||
console.log(out);
|
||||
}
|
||||
const out = `${header}\n${indented}\n`;
|
||||
writeSync(isSlow ? 2 : 1, out);
|
||||
}
|
||||
|
||||
// ── 결과 로깅 ($extends) ──────────────────────────────────────────
|
||||
@@ -198,7 +196,7 @@ function logResult(
|
||||
if (!logger.isEnabled("debug")) return;
|
||||
const ts = new Date().toISOString();
|
||||
const body = buildResultLog(model, operation, result);
|
||||
console.log(`[${ts}] [DEBUG] [db:result] ${body}`);
|
||||
writeSync(1, `[${ts}] [DEBUG] [db:result] ${body}\n`);
|
||||
}
|
||||
|
||||
// ── PrismaClient 생성 ─────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user