Disable prisma logs on prod (#371)

* disable prisma logs on prod

* linting

* keep const top level

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
This commit is contained in:
Sean Hatfield 2023-11-14 13:53:11 -08:00 committed by GitHub
parent a96a9d41a3
commit 1aa58dcb7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,8 +5,12 @@ const { PrismaClient } = require("@prisma/client");
// npx prisma migrate dev --name init -> ensures that db is in sync with schema // npx prisma migrate dev --name init -> ensures that db is in sync with schema
// npx prisma migrate reset -> resets the db // npx prisma migrate reset -> resets the db
const isProd = process.env.NODE_ENV === "production";
const logLevels = isProd
? ["error", "info", "warn"]
: ["query", "info", "warn", "error"];
const prisma = new PrismaClient({ const prisma = new PrismaClient({
log: ["query", "info", "warn"], log: logLevels,
}); });
module.exports = prisma; module.exports = prisma;