https://www.prisma.io/ logo
#orm-help
Title
# orm-help
l

Lucas Pelegrino

09/28/2022, 12:48 AM
What’s up everyone! Is there any way to overwrite the original Prisma logger with my own? I can find in the docs a reference to logging with Prisma, but not sure if it’s possible to have Prisma use my own logger by default. I tried using this:
Copy code
this.$on('query', (event) => {
  this.logger.debug(`Query: ${event.query}`, PrismaService.name);
}
It duplicates the logs, one time with my custom logger and one time (logged first) with prisma’s default one.
1
n

Nurul

09/28/2022, 6:31 AM
Hey @Lucas Pelegrino 👋 One alternative I could think of is that you can not use the native Prisma logger and only use your own custom logger through Middleware, here’s an example of implementation of a custom logger with middleware
🤘🏻 1
l

Lucas Pelegrino

09/28/2022, 5:47 PM
Hey @Nurul! I’ll give it a shot and see what I can spin around with it. Appreciate the idea! 💡
🙌 2
3 Views