Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

ignore routes #43

Closed
dennisevnex opened this issue Mar 20, 2020 · 3 comments
Closed

ignore routes #43

dennisevnex opened this issue Mar 20, 2020 · 3 comments

Comments

@dennisevnex
Copy link

Is there a way to ignore routes from logging like /health?

@mcollina
Copy link
Member

See the autoLogging.ignorePaths option: https://github.com/pinojs/pino-http/blob/master/README.md#api

@dennisevnex
Copy link
Author

thank you

@muuhoffman
Copy link

I was still struggling with this and this worked well for me to ignore a hierarchy of paths from next.js

const expressLogger = expressPino({
  autoLogging: {
    ignorePaths: ["/_next"],
    getPath: (req) => {
      if (/_next/.test(req.url)) {
        return "/_next"
      }
      return req.url
    }
  },
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants