Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic serializer swapping #40

Open
davidmarkclements opened this issue Oct 25, 2017 · 2 comments
Open

dynamic serializer swapping #40

davidmarkclements opened this issue Oct 25, 2017 · 2 comments

Comments

@davidmarkclements
Copy link
Member

Consider a situation where we log every time for a certain route,
and we're not interested in seeing the request completed for this route
(in particularly I'm thinking about transmitting logs from the browser to the server,
say to a /logs route)

I'd like to be able to do

var pinoHttp = require('pino-http')({ignore: ['/logs']}) 

and maybe even

var pinoHttp = require('pino-http')({ignore: [{method: 'POST', url: '/logs'}]}) 

It would also be good to be able to do

var pinoHttp = require('pino-http')
pinoHttp.ignore('/logs') // or pinoHttp.ignore({method: 'POST', url: '/logs'}]})

This wouldn't remove the req.log method, it would just avoid emitting the "request completed" log for a route

@mcollina
Copy link
Member

I do not think it's a great idea. We would need to a router, and then parametric routes, and then wildcards, and then this would become very slow. Let's log everything.

@davidmarkclements
Copy link
Member Author

another approach... if we could dynamically swap out the req serializer the log message from the browser could be injected into the req object instead on request completed to a /logs endpoint

@davidmarkclements davidmarkclements changed the title route ignoring dynamic serializer swapping Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants