H4ad / nodejs-logging-proposal

3 stars 0 forks source link

on-exit-leak-free, copy or move to core? #10

Open H4ad opened 6 months ago

H4ad commented 6 months ago

@mcollina What do you think? That module sounds very useful to have on core, the simplicity makes me want to copy the code but I think we could just expose that as a wrapper for FinalizationRegistry.

We have some issues with the registry but it was solved, the crashes were also fixed by legendas, so maybe we can rely again on this feature.

We probably could expose those functions inside process, maybe something like:

process.registerOnExit(obj, fn);
process.registerBeforeOnExit(obj, fn)
mcollina commented 6 months ago

https://github.com/nodejs/node/issues/48058 < There was quite a lot of objections in bringing this in.

You might want to open that again.

I think those two functions would be incredibly useful for the ecosystem.

H4ad commented 6 months ago

Instead of re-opening the issue, I will create a PR to introduce those two functions as I mentioned earlier, feel free to suggest other API Design instead of those I suggested.

I think with a PR, we will move faster than trying to wait for comments on an issue.

mcollina commented 6 months ago

let's do it