I have a shared package in my monorepo that contains a pino logger file, which is used across several Next.js applications.
The logger file uses the pino-pretty module to format the logs.
I'm using the new pino v7+ transports, which require non-serializable options. To use messageFormat as a function, I'm trying to wrap pino-pretty as suggested in the documentation.
However, I am struggling to include the pino-pretty-transport file in my shared library and make the custom messageFormat works when I use the exported logger on one of the NextJs App
I am not sure how to proceed with resolving this issue. Could you please provide some guidance on how to include the custom pino-pretty-transport module in my shared library/Next.js builds?
Hello,
I have a shared package in my monorepo that contains a pino logger file, which is used across several Next.js applications. The logger file uses the pino-pretty module to format the logs.
I'm using the new pino v7+ transports, which require non-serializable options. To use messageFormat as a function, I'm trying to wrap pino-pretty as suggested in the documentation.
However, I am struggling to include the pino-pretty-transport file in my shared library and make the custom messageFormat works when I use the exported logger on one of the NextJs App
I am not sure how to proceed with resolving this issue. Could you please provide some guidance on how to include the custom pino-pretty-transport module in my shared library/Next.js builds?
Technical Details:
pino-pretty-transport.ts
(shared library)logger.ts
(shared library)Built with tsup (shared library):
=> 3 files in shared dist folder
Then using shared library in one of the NextApp ->
Tried with require.resolve, path.resolve, but not sure how to fix this if you have ideas. Thanks in advance