felixheck / laabr

well-formatted, extendable pino logger for hapi.js
MIT License
50 stars 7 forks source link

logQueryParams is not allowed #104

Closed femans closed 2 years ago

femans commented 2 years ago

version 6.1.3 The option logQueryParams is disabled in the joi validation, and this makes it impossible to access the query parameters in the logger. (For my specific use case this makes the library unusable). It is easy enough to allow it, I think. Is there any specific reason why this has been disabled?

felixheck commented 2 years ago

Thanks for raising this issue, @femans. I quickly checked the code and the behaviour. I don't have a rule for logQueryParams defined but allowed explicitly "unknown" keys (such as in this case) in my validation for hapi-pino and pino options.

My guess: nest it inside the hapiPino option and you are fine ๐Ÿ‘‡

await server.register({
  plugin: laabr,
  options: {
    hapiPino: { logQueryParams: true }ย 
  },
});
femans commented 2 years ago

Thanks @felixheck , for the swift answer. This indeed solves it! I am sorry I could not figure this out from the docs.

felixheck commented 2 years ago

All good, itโ€™s quite a lot of options and easy to miss ๐Ÿ˜Š take care.