<@UF0B95GBX> If you mean logging of Prisma Client ...
# orm-help
j
@Nishant If you mean logging of Prisma Client queries, the option you're looking for is
debug
in the Client constructor, per: https://www.prisma.io/docs/prisma-client/setup/constructor-JAVASCRIPT-rsc4/
n
@jangerhofer Thanks for that . I tried the following approach
const typeDefs = require("./typeDefs"); const resolvers = require("./resolvers"); import { prisma } from "./prisma/generated/prisma-client"; ..... prisma = new Prisma({ debug: true, }); const server = new ApolloServer({ typeDefs, resolvers, context: { prisma }, }); ......
The problem is that i already have a prisma variable that refers to auto generated prisma client file. How can i use this to override some params?
j
Ah, the missing piece of information is that the
prisma
variable exported from
generated/prisma-client
is a pre-configured client instance. It is, however, an easy fix to create your own client instance!
Notice at the bottom of the
generated/prisma-client/index
file that there are two exports which should resemble:
Copy code
export const Prisma = makePrismaClientClass<ClientConstructor<Prisma>>({
  typeDefs,
  models,
  endpoint: `${process.env["PRISMA_ENDPOINT"]}`,
  secret: `${process.env["PRISMA_SECRET"]}`
});
export const prisma = new Prisma();
Instead of importing the latter lower-case-"p"
prisma
into your code, grab the capital-"P"
Prisma
export and use that in the place you already tried to use
debug
!
Copy code
import { Prisma } from "./prisma/generated/prisma-client";
...
const client = new Prisma({debug: true})
Or
debug: false
in your case, I suppose! 🙂