pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

pino.final() typings still remains on latest branch #1543

Closed yukha-dw closed 2 years ago

yukha-dw commented 2 years ago

Hello, while I'm trying to find a fix for print out any left over logs when using asynchronous logging, I've found this issues #542 and get 2 possible solutions, using timeout and pino.final().

But, after further reading, pino.final() is already removed but the typings still remains on latest branch. https://github.com/pinojs/pino/blob/3388e68dad46cb7537c2d35d837a17ea12e240ff/pino.d.ts#L750-L763

mcollina commented 2 years ago

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

yukha-dw commented 2 years ago

You can check it here: https://github.com/ouwyukha/pino-sb-error/tree/5750148c1c2da6ba338c29150087400ecf753eee

Calling yarn dev will return TypeError

yarn run v1.22.18
warning package.json: No license field
$ ts-node src/server.ts
{"level":30,"time":1662024053670,"pid":10100,"hostname":"ubuntu","msg":"Server listening at http://0.0.0.0:3001"}
TypeError: pino_1.default.final is not a function
    at init (C:\src\server.ts:20:10)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
mcollina commented 2 years ago

I'm sorry I don't understand this issue. The title mention typings but then you mention flushSync(). If the problem is that final() is not there, it was removed because it's no longer needed, we can safely remove it from the typings. However it seems you want to achieve something specific, so I would love to get a reproduction of the problem you are trying to solve.

yukha-dw commented 2 years ago

I'm sorry I don't understand this issue. The title mention typings but then you mention flushSync(). If the problem is that final() is not there, it was removed because it's no longer needed, we can safely remove it from the typings. However it seems you want to achieve something specific, so I would love to get a reproduction of the problem you are trying to solve.

My bad, my original report is typing of final() method still exists. Please ignore the EDIT section

mcollina commented 2 years ago

Here is the PR that removes it completely: https://github.com/pinojs/pino/pull/1544. Thanks for catching.

github-actions[bot] commented 2 years ago

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.