Reputation: 46599
const server = fastify({
logger: {
level: process.env.LOGLEVEL || 'debug',
prettyPrint:
process.env.ENVIRONMENT === 'local'
? {
translateTime: 'HH:MM:ss',
ignore: 'pid,hostname',
}
: false,
},
});
LOGLEVEL
is set to trace
. But my requests are being logged at info
level, which is higher than I want it to be:
[19:55:00] INFO: request completed
res: {
"statusCode": 200
}
responseTime: 8.38587498664856
reqId: "req-1"
I don't think metrics like that belong at info
level. How can I alter the logging setup so that request logging is at the trace
level? I don't see any setting for this in the docs about logging.
Upvotes: 1
Views: 1936
Reputation: 2299
There is an official server option, disableRequestLogging, to fully disable it.
Then it is up to you to log with customized level in onRequest
and onRequests
hooks.
Upvotes: 4