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

Typing of logger field on Request is misleading in case of ignored routes #186

Open
nlochschmidt opened this issue Jan 16, 2024 · 0 comments
Labels

Comments

@nlochschmidt
Copy link

Runtime

node.js

Runtime version

18

Module version

12.2.0

Last module version without issue

No response

Used with

hapi application

Any other relevant information

No response

What are you trying to achieve or the steps to reproduce?

In certain cases I would like to access pino logger specific attributes and functions (e.g. bindings()) even when the route accessing logger might later be ignored using any of the ignoreX options.

What was the result you got?

TypeErrors such as logger.bindings is not a function requiring me to build checks around the presence of methods such as bindings.

What result did you expect?

I was expecting the logger instance on the request to always be of type pino.Logger, but it might be the much simpler nullLogger instance from abstract-logging that is used in case of ignored routes.

Ideally the nullLogger should be extended to implement all methods of the pino.Logger interface, alternatively the typings in hapi-pino should reflect that the logger might be missing some of the methods in pino.Logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant