pino logger configuration that works on server as well as on the browser

27 Views Asked by At

Can the same logger be used for the browser and server. Here is the configuration for the logger. When I log on the server of an express application it does not log anything, it logs on the browser however. Do I need to separate the browser and server logger configurations or should this work? If so, what I'm am doing wrong?

            const logger = pino({
               browser: {
                  asObject: true,
                  serialize: true
               },
                  level: 'info',
                  name: 'app',
                  levels: levels,
                 transport: {
                  target: 'pino-pretty',
                  options: {
                    colorize: true,
                    minimumLevel: 'info',
                    timestampKey: 'time',
                    levelFirst: true,
                    ignore: 'pid,hostname',
                    levels: levels,
               }
           },
              serializers: {
              req: pino.stdSerializers.req,
              res: pino.stdSerializers.res
        }
    })

0

There are 0 best solutions below