Uses reply.log.info for 2xx/3xx and reply.log.error for 4xx/5xx,
so each log record is automatically correlated with the request ID assigned by Fastify.
Client-controlled fields (URL, Referer, User-Agent) are sanitized via
sanitize so embedded control characters cannot forge log entries.
Parameters
request: FastifyRequest
The completed Fastify request.
reply: FastifyReply
The Fastify reply containing status, headers, and elapsed time.
Fastify
onResponsehook that logs completed request details:Intended to be registered via:
Uses
reply.log.infofor 2xx/3xx andreply.log.errorfor 4xx/5xx, so each log record is automatically correlated with the request ID assigned by Fastify.Client-controlled fields (URL,
Referer,User-Agent) are sanitized via sanitize so embedded control characters cannot forge log entries.