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

Support new nestedKey config to avoid property name collisions with pino standard properties when logging objects #759

Merged
merged 4 commits into from Jan 11, 2020

Conversation

matthewadams
Copy link
Contributor

@matthewadams matthewadams commented Jan 7, 2020

Some people log objects a lot. Those objects, in general, may have properties that conflict with pino's standard logging fields (level, v, pid, etc). Also, when searching logs for logged objects, it's nice to always have them in a consistent location (that is, property of the root log record object).

This PR adds a new config option objectKey nestedKey that causes log records to include a key whose name is the value of the objectKey nestedKey config, and whose value is the logged object (if it is an object and not a string). It allows folks using things like Kibana, StackDriver, MongoDB, etc, to consistently know the path in their log records to search for, and guarantees that no logged object's properties will conflict with pino's standard properties.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! I left a nit

package.json Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@davidmarkclements davidmarkclements left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good addition, just have some change requests

docs/api.md Outdated Show resolved Hide resolved
docs/api.md Outdated Show resolved Hide resolved
@matthewadams matthewadams changed the title Support new objectKey config to avoid property name collisions with pino standard properties when logging objects Support new nestedKey config to avoid property name collisions with pino standard properties when logging objects Jan 7, 2020
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina
Copy link
Member

mcollina commented Jan 8, 2020

@davidmarkclements are you good with this now?

@davidmarkclements
Copy link
Member

@davidmarkclements are you good with this now?

yes

@davidmarkclements davidmarkclements merged commit 6fae12a into pinojs:master Jan 11, 2020
@davidmarkclements
Copy link
Member

@github-actions
Copy link

github-actions bot commented Feb 3, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants