hapijs / good

hapi process monitoring
Other
525 stars 160 forks source link

How to customize data being passed to reporter? #481

Closed nerdpad closed 8 years ago

nerdpad commented 8 years ago

For every request my server receives, I would like to log few extra fields (user, a tracking id passed in the header).

I am using good-bunyan, and have an option to write a formatter for response event.

How can I customize the data that is passed to the reporter?

arb commented 8 years ago

What version of good? If it's 6, you'll need to write a customer reporter.

If it's 7, you have a lot more options for how you can customize your event payloads. You can create your own transform stream and attach this "extra data" in _transform before passing it down the pipeline.

nerdpad commented 8 years ago

I am using 6, and I was already using good-bunyan reporter, so I had to exclude response, and handle it manually.

v7 just got released, so I will look into the transform, if that helps.

Thanks for the help.

gilly3 commented 8 years ago

I have nearly the exact same question - I want to log the user name and a tracking id for each request. I am also using v6.6 (of course, since v7 was only published yesterday). Are there release notes? What is the breaking change?

arb commented 8 years ago

https://github.com/hapijs/good/issues/467 are the release notes.

If you are using good 6 and you want to customize your outputs, you're only real option is to roll your own reporter. If you want to read up on doing that, start here https://github.com/hapijs/good/blob/v6.6.3/API.md

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.