-
Notifications
You must be signed in to change notification settings - Fork 885
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
A "nestedKeyName: {}" is always added to the log and displayed by pretty even if there is nothing to nest #1166
Comments
This looks like a bug. Would you like to send a PR to fix it? |
probably in the line with mixin defined. If that's the case this ha not been introduced in v7, what's the latesr version this was working for you? |
For me, it definitely looks like a v7 related change/bug. const logger = require('pino')({nestedKey:'nest'});
logger.info({asd:'1'});
logger.info('hello'); pino v6.13.3 results: {"level":30,"time":1634576867070,"pid":41448,"hostname":"x","nest":{"asd":"1"}}
{"level":30,"time":1634576867071,"pid":41448,"hostname":"x","msg":"hello"} pino v7.0.2 results: {"level":30,"time":1634577116365,"pid":41717,"hostname":"x","nest":{"asd":"1"}}
{"level":30,"time":1634577116365,"pid":41717,"hostname":"x","nest":{},"msg":"hello"} <- 'nest' added in v7 |
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I would be happy to help, but I think this task might require a deeper understanding of the codebase that I currently have in this project. |
A git bisect shows that this behavior was introduced in #885 |
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. |
If I set the
nestedKey: payload
option, the nested key is always added to the log and pino-pretty also displays it every time, even if I try to log a simple string (and if I can remember correctly, this was not the case with v6).A simple
logger.info('info');
makes pino-pretty (withbase: undefined, timestamp: pino.stdTimeFunctions.isoTime
options) show the following:My current workaround:
Right now I'm using the following hook method to achieve similar results as v6 (only wrap object if necessary):
The text was updated successfully, but these errors were encountered: