Query: SELECT "public"."User"."id", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1
warn - You have enabled experimental feature (serverComponentsExternalPackages) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
表示できるログは
query
info
warn
error
です。
Prisma
Configuring logging (Concepts)Learn how to configure Prisma Client to log the raw SQL queries it sends to the database and other information.
Next.jsでは次のようにコンソールに表示するログを表示します。
logの配列を変更することで、表示するログを変更することができます。
import { PrismaClient } from "@prisma/client";
let prisma: PrismaClient;
if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient();
} else {
const globalWithPrisma = global as typeof globalThis & {
prisma: PrismaClient;
};
if (!globalWithPrisma.prisma) {
globalWithPrisma.prisma = new PrismaClient({
log: ["query", "error", "info", "warn"],
});
}
prisma = globalWithPrisma.prisma;
}
export default prisma;
コメント