pino icon indicating copy to clipboard operation
pino copied to clipboard

Consider limiting object traversal depth (was: Add default serializer)

Open ruiaraujo opened this issue 6 years ago • 4 comments

Currently if the mergingObject is an object with access to things like an Agent instance or other deeply rich objects, pino will try to copy to the output the entire object.

Even though, this can be attributed to programming errors, if one would have a default serializer option for the mergingObject, the user can limit the logging operation on this object.

Another option would be adding a level to which mergingObject will be serialized which for this particular use case would also suffice.

ruiaraujo avatar Sep 09 '19 16:09 ruiaraujo

I do not understand what you are saying. What is "the Agent instance"? Is your desire not solved by https://github.com/pinojs/pino/blob/146d803e6956638861f57d4d46b275aa8c80fa1d/docs/api.md#serializers-object ?

jsumners avatar Sep 09 '19 17:09 jsumners

Not really, due to some programming mistake someone passed in an object using a name that was not in the serializers list.

This object was recursive (which I believe it is handled due to seeing Circular showing up in those logs) and very big and the node process ran out of memory while attempting to log it.

My request is to allow these mistakes to happen without terrible consequences like crashing servers. :smile:

ruiaraujo avatar Sep 09 '19 18:09 ruiaraujo

How would you implement this? I’m not sure I’m following.

mcollina avatar Sep 10 '19 06:09 mcollina

I will take a look at the codebase to see how this could be done.

ruiaraujo avatar Sep 10 '19 14:09 ruiaraujo

@ruiaraujo Did you manage to resolve this?

Fdawgs avatar May 29 '23 08:05 Fdawgs

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[bot] avatar Jun 29 '23 00:06 github-actions[bot]