H4ad / nodejs-logging-proposal

3 stars 0 forks source link

Should we support circular references by default? #3

Closed H4ad closed 6 months ago

H4ad commented 6 months ago

Pino uses the lib safe-stable-stringify to be able to avoid circular references: https://github.com/pinojs/pino/blob/8db130eba0439e61c802448d31eb1998cebfbc98/pino.js#L115-L118

Should we support this by default? It's a good thing to have but I don't know if worth having this entire lib just to avoid circular references.

Circular references is something common to have? If not, maybe we could remove and use the native stringify.

Pino supports customizing the serializers, so it's not a big deal not have this by default since the users can just install https://github.com/BridgeAR/safe-stable-stringify and then handle the circular references.

H4ad commented 6 months ago

If we remove this dependency, we can create a way to the user to customize the following code that is responsible for the serialization: https://github.com/pinojs/pino/blob/main/lib/tools.js#L342-L353

Maybe pino already exposes a way but I didn't find where I can customize it.

H4ad commented 6 months ago

This issue is also related to the https://github.com/H4ad/nodejs-logging-proposal/issues/7

H4ad commented 6 months ago

~Blocked by #4~

We will rewrite pino.

H4ad commented 6 months ago

No, at least for now, we will not support circular references.