PingZing
PingZing
PPrisma
Created by PingZing on 12/17/2024 in #help-and-questions
Declaring a PrismaClient with conditional logging
(Also, hooray for rubber ducking with AI assistance 😅)
7 replies
PPrisma
Created by PingZing on 12/17/2024 in #help-and-questions
Declaring a PrismaClient with conditional logging
👍 In that case, I think this can be marked as "Solved". Do I do that myself, somehow?
7 replies
PPrisma
Created by PingZing on 12/17/2024 in #help-and-questions
Declaring a PrismaClient with conditional logging
oh, hey, digging into the GitHub issue mentioned by the AI led me to https://github.com/prisma/prisma/issues/11986#issuecomment-1119739964:
in that case, I think, you should be able to specify all events during compile time and then just subscribe to the ones you need in run time:
...which works well enough, I suppose!
7 replies
PPrisma
Created by PingZing on 12/17/2024 in #help-and-questions
Declaring a PrismaClient with conditional logging
Asking the AI gave me a kind of a workaround: if I adjust my declaration to
private _prismaClient: PrismaClient<Prisma.PrismaClientOptions, "error" | "warn">;
private _prismaClient: PrismaClient<Prisma.PrismaClientOptions, "error" | "warn">;
...then that works, but it still requires me to know ahead of time what error levels I'll be logging. I'd like to allow logging levels to be actually dynamic, if possible.
7 replies