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
fastify.log.isLevelEnabled()
is missing from TypeScript types
#5382
Comments
I would say it is a As a workaround, you can supply the cc @fastify/typescript |
That makes sense. Supporting custom loggers wasn't on my mind but perhaps it requires some more thought... The generic could extend the BaseLogger, but default to Pino's full logger. That should support the current API contract. I feel like this should still merit consideration as the current TypeScript types are masking existing default functionality. |
That sound do-able. We may try to see how it works. |
I took a stab at it in the PR above ^ |
Prerequisites
Fastify version
4.26.2
Plugin version
No response
Node.js version
18.19.1
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
Pino exposes a function
logger.isLevelEnabled()
which is available withing Fastify, but the TypeScript typing doesn't implement it. The typeFastifyBaseLogger
should be updated to extendpino.Logger
in order to have the exact interface which matches what pino is exposing.Conveniently,
pino.Logger
also implementschild()
so that can be removed from Fastify's types.Inside
types/logger.d.ts
:Steps to Reproduce
With the following TypeScript:
Expected Behavior
The value of
server.log
should expose the full Pino interface.The text was updated successfully, but these errors were encountered: