From 1aa58dcb7b80841e092a6da7aaea3524cd2fbe7c Mon Sep 17 00:00:00 2001
From: Sean Hatfield <seanhatfield5@gmail.com>
Date: Tue, 14 Nov 2023 13:53:11 -0800
Subject: [PATCH] Disable prisma logs on prod (#371)

* disable prisma logs on prod

* linting

* keep const top level

---------

Co-authored-by: timothycarambat <rambat1010@gmail.com>
---
 server/utils/prisma/index.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/utils/prisma/index.js b/server/utils/prisma/index.js
index 64a63f074..05c03eb76 100644
--- a/server/utils/prisma/index.js
+++ b/server/utils/prisma/index.js
@@ -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 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({
-  log: ["query", "info", "warn"],
+  log: logLevels,
 });
 
 module.exports = prisma;
-- 
GitLab