-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
feature requestNew feature to be addedNew feature to be addedsemver-minorIssue or PR that should land as semver minorIssue or PR that should land as semver minor
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Expose fastify param createRequestLogMessage, which would allow customizing request param log message.
Motivation
Currently logic for request logging looks like this:
if (disableRequestLogging === false) {
childLogger.info({ req: request }, 'incoming request')
}
It is not possible to customize it, which may sometimes be desireable.
Example
It would be great to be able to replace incoming request with a custom-built message. So something like
if (disableRequestLogging === false) {
childLogger.info({ req: request }, createRequestLogMessage(req))
}
createRequestLogMessage would default to a function which returns 'incoming request'.
Full usage example:
const app = fastify({
createRequestLogMessage: (req) => { return `${req.id}: incoming request`
})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestNew feature to be addedNew feature to be addedsemver-minorIssue or PR that should land as semver minorIssue or PR that should land as semver minor