Skip to content

Remove URL rewrite logging? #4753

@brettwillis

Description

@brettwillis

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

If the rewriteUrl function is used, then a debug log is generated:

fastify/fastify.js

Lines 798 to 800 in c4cb3a8

const url = rewriteUrl(req)
if (originalUrl !== url) {
logger.debug({ originalUrl, url }, 'rewrite url')

This issue is more of a personal preference, but this behaviour creates a lot of extra log entries (1 per every request), which in my mind are not interesting.

My proposal is that the logging be removed. If the developer is interested in knowing when the URL is changed, then they can write their own log in the rewriteUrl function that they provide. Perhaps then we need to bind the rewriteUrl function to the fastify instance, or provide it as a parameter to they can access the logger easily.

Small bonus is that in this way we can also eliminate the URL equality check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions