hapijs/hapi-pino

Cannot get a custom pino instance with pino-pretty to work

tcurdt opened this issue · 1 comments

Runtime

nodejs

Runtime version

v20.11.0

Module version

12.1.0

Used with

hapi 21.3.3

Any other relevant information

Maybe this is related? #179

How can we help?

I am trying to use hapi-pino to log pretty print log messages to the console.

    const pino = Pino({
      transport: {
        target: 'pino-pretty',
        options: {
          colorize: true
        }
      }
    })

    return [
      {
        plugin: HapiPino,
        options: {
          instance: pino,
          level: 'info',
          logPayload: true,
          logQueryParams: true,
          logPathParams: true,
          log4xxResponseErrors: true,
        }
      }
    ]

Unfortunately it seems like the instance gets ignored.

It still just comes out as json:

{"level":30,"time":1707492507295,"pid":78397,"hostname":"foo","created":1707492506898,"started":1707492507295,"host":"foo","port":9000,"protocol":"http","id":"foo:78397:lsesyadu","uri":"http://foo:9000","address":"127.0.0.1","msg":"server started"}

Not sure what happened. After another npm i it seems to work now.