fix(api): add req to the child logger (#59961)

This commit is contained in:
Mrugesh Mohapatra
2025-04-25 01:05:57 +05:30
committed by GitHub
parent ff38233f96
commit fada6f08f8

View File

@@ -15,7 +15,7 @@ const fourOhFour: FastifyPluginCallback = (fastify, _options, done) => {
// If the request accepts JSON and does not specifically prefer text/html,
// this will return a 404 JSON response. Everything else will be redirected.
fastify.setNotFoundHandler((req, reply) => {
const logger = fastify.log.child({});
const logger = fastify.log.child({ req });
logger.info('User requested path that does not exist');
const accepted = req.accepts().type(['json', 'html']);