fastify / help

Need help with Fastify? File an Issue here.
https://www.fastify.io/
65 stars 8 forks source link

how to setup rotating files and different settings #891

Open RjManhas opened 1 year ago

RjManhas commented 1 year ago

Hello im using the fastify logger and with pino-pretty

this is what my current app looks like logger: { transport:{ target: 'pino-pretty', } }

and i want to be able to disable pino pretty based of if env is set to production or development and how to setup it logging to a file and rotating it.

Uzlopak commented 1 year ago
function getLoggerByEnv() {
  let result = undefined
  switch (process.env.LOGGER) {
    case "pino-pretty":
       result = transport:{
        target: 'pino-pretty',
      }
      break
  }
  return result
}

logger: getLoggerByEnv()