Fastify onResponse hook that logs completed request details:
onResponse
{ip} -- {method} {url} HTTP/{httpVersion} {status} {size} {elapsed}ms "{referrer}" "{userAgent}" Copy
{ip} -- {method} {url} HTTP/{httpVersion} {status} {size} {elapsed}ms "{referrer}" "{userAgent}"
Intended to be registered via:
fastify.addHook("onResponse", onResponse) Copy
fastify.addHook("onResponse", onResponse)
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.
reply.log.info
reply.log.error
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.