-
Notifications
You must be signed in to change notification settings - Fork 60
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
Logging information from user credentials #128
Comments
Great idea!
This has some GDPR implications and I prefer not to release something that could cause issues for users. |
@chrisshiplet Can you explain how you included the credentials using a custom serializer? For me the I also tried using the |
Regarding the original issue here, apologies I never got time to work on it! Unfortunately I no longer work on the project this feature was required for. I also didn't consider the GDPR implications of this at the time since we're not subject to it, although I'm currently learning all about CCPA... @markopy Sure thing! I'm not sure how useful this will be for you. I'm definitely getting the request object I expect right in the serializer. I pass this into pino's options object:
and it "just works". This project was on Hapi |
Thanks @chrisshiplet. For some reason on Hapi What did work though is this:
which I found via issue #121 (comment) |
I solved this problem by using |
In case anyone else needs this, my previous method using
This is better and cleaner since the auth information will now be attached to all log calls happening during request handling as well as to the final response logging. |
It's useful for me to be able to access a user's ID or email address when investigating errors reported from our Hapi project. This metadata is in Hapi's
request.auth.credentials
object, so usinghapi-pino
I can access that information for request logs with a custom serializer since they include thereq
object. However, for error logs, thereq
object does not seem to be included at all.The easiest fix would be to simply include the
req
object with errors... but I also wonder if anyone has ideas about logging thecredentials
object across the board? A lot of logging/issue tracking services like Sentry have first class support for tracking users like this and it'd be nice for this to "just work" without messing around with thereq
serializer.The text was updated successfully, but these errors were encountered: