Closed budarin closed 2 years ago
The info
log level is set up by Fastify itself and cannot be changed. What you can chage is the minimum log level for the healthcheck route, like so:
.register(underPressurePligin, {
exposeStatusRoute: {
routeOpts: {
logLevel: 'warn',
},
url: '/alive',
},
healthCheck: async function (fastifyInstance) {
// do some magic to check if your db connection is healthy, etc...
return true;
},
})
In this way the info logs will be hidden.
I just want not to log health checks in production (when pino.logLevel
is set to info
)
and log it in dev env (when pino.logLevel
is set to trace
)
the above should do the trick
I'm sorry, but from the description in the documentation it is completely unclear how the setting of this parameter affects the display of information in the logs
log level
always refer to the the minimum logging level
which means the logging message equal or above that level will be display.
If you know that all the log are in info
level, setting any log level
above info
will disable the log showing, for example warn
, error
or fatal
.
Thanks for the explanation!
Prerequisites
Fastify version
3.28.0
Plugin version
5.8.1
Node.js version
18.0.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10.06.2020
Description
the contents of the log after executing the request
log level is
info
instead ofdebug
Steps to Reproduce
setup server with
under-pressure
plugin with above config an runExpected Behavior
expected loglevel for status route to be as defined in config