Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tcurdt opened this issue Feb 9, 2024 · 1 comment
Closed

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

tcurdt opened this issue Feb 9, 2024 · 1 comment

Comments

@tcurdt
Copy link

tcurdt commented Feb 9, 2024

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"}
@tcurdt
Copy link
Author

tcurdt commented Feb 9, 2024

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

@tcurdt tcurdt closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant