Closed kibertoad closed 1 week ago
Previously this was the way to instantiate a synchronous pino-pretty logger (which is very convenient for tests):
import pretty from 'pino-pretty' const logger = pino( pretty({ sync: true, minimumLevel: appConfig.logLevel as Level, colorize: true, translateTime: 'SYS:standard', ignore: 'hostname,pid', }), ) const app = fastify({ logger })
Unfortunately, this no longer works, because fastify 5 only supports logger configuration but not preinstantiated logger. How does one use pino-pretty while still respecting the sync attribute now?
sync
Use fastify({ loggerInstance: logger }) This is mentioned in the migration guide.
fastify({ loggerInstance: logger })
thank you!
💬 Question here
Previously this was the way to instantiate a synchronous pino-pretty logger (which is very convenient for tests):
Unfortunately, this no longer works, because fastify 5 only supports logger configuration but not preinstantiated logger. How does one use pino-pretty while still respecting the
sync
attribute now?Your Environment