-
Notifications
You must be signed in to change notification settings - Fork 27
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
not best practice to bind to Node request and response object? #14
Comments
if you're open to this I will submit PR to fix, would require a major version bump and also a deprecation notice IMO |
I'm +1, that should be a semver-major change. |
I know nothing of Koa. Do whatever is best. |
Thanks, I'll make a PR now! Also feel free to add me to NPM and GitHub so I can help maintain this package. I use it directly in CabinJS https://cabinjs.com and Lad https://lad.js.org. |
Actually it looks like The reason we need to pass the Node request and response object to Any thoughts as to what we can do here? |
I think we should follow the same approach we do in hapi-pino, mainly building a custom module for Koa. Would that make sense? Would you like to send a PR? |
@mcollina are you still interested in building a custom module for Koa ? There are some limitations apart from the fact that this module is only a thin wrapper around pino-http. |
It'd be great if somebody contributed a PR :). |
@mcollina ok I'm in. |
@stephanebachelier: Where did you end up with this? I've built out a fair bit of log enrichment outside of process that I'd like to get rid of. |
I think that it'd be best practice to not bind to the Node request/response object and instead just solely bind to the Koa request and response object.
https://github.com/pinojs/koa-pino-logger/blob/master/logger.js#L11
Also not having
ctx.res.log
to begin with is kind of odd since you're binding toctx.response.log
andctx.req.log
, should be a 1:1 relationship.The text was updated successfully, but these errors were encountered: