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