-
Notifications
You must be signed in to change notification settings - Fork 876
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
Global serializer invoked on child creation #679
Comments
This is explicit behavior. We added this to make child logger extremely fast. The object passed to child() is stringified and appended to the base, so we don’t have to do it at runtime for all logs. |
That's definitely not documented https://github.com/pinojs/pino/blob/129be44f4bda99e7ae6407e0d317fcd98d3d0da2/docs/api.md#serializerssymbolforpino-function |
As most things, it was the result of an endless debate on Github a long time ago :D. |
I think it is a conflict of interest in wanting a global serializer but and wanting speed. No real solution other than to document the behavior. |
I've spent at least a day now debugging and trying to figure out why my global serializer wasn't working in certain situations, and it turns out to be due in part to this. I definitely think this is a bug that should be fixed |
@chrisregnier I’m sorry to hear. Can you please make an example with cls-hook and the other issues you mentioned? It seems you are talking about different behavior changes at the same time. |
This will output:
Serializers should only be executed when a log function is invoked, e.g.
log.info
.The text was updated successfully, but these errors were encountered: