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

Child property binding duplicated when property appears in log statement #625

Closed
jcald1 opened this issue Apr 1, 2019 · 3 comments
Closed

Comments

@jcald1
Copy link

jcald1 commented Apr 1, 2019

Summary

I set up a property ("a") in the child binding then I logged an object containing that same property name ("a"). Instead of overriding the binding value, the key is duplicated in the JSON.

Code

const logger = require('pino')()
logger.info('test')

const child = logger.child({a: 'prop', b: 'prop' })
child.info('test')
child.info({a: 'new prop'})

Output

{"level":30,"time":1554156372574,"pid":9088,"hostname":"MLP-0U8HV2H","msg":"test","v":1}
{"level":30,"time":1554156372575,"pid":9088,"hostname":"MLP-0U8HV2H","a":"prop","b":"prop","msg":"test","v":1}
{"level":30,"time":1554156372575,"pid":9088,"hostname":"MLP-0U8HV2H","a":"prop","b":"prop","a":"new prop","v":1}
@davidmarkclements
Copy link
Member

Yes this is expected behavior, it’s a performance trade off

@davidmarkclements
Copy link
Member

davidmarkclements commented Apr 1, 2019

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

This issue 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 7, 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

No branches or pull requests

2 participants