Skip to content
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

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

Closed
yukha-dw opened this issue Sep 1, 2022 · 6 comments · Fixed by #1544
Closed

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

yukha-dw opened this issue Sep 1, 2022 · 6 comments · Fixed by #1544

Comments

@yukha-dw
Copy link

yukha-dw commented Sep 1, 2022

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.

pino/pino.d.ts

Lines 750 to 763 in 3388e68

/**
* The pino.final method can be used to create an exit listener function.
* This listener function can be supplied to process exit events.
* The exit listener function will call the handler with
* @param [logger]: pino logger that serves as reference for the final logger
* @param [handler]: Function that will be called by the handler returned from this function
* @returns Exit listener function that can be supplied to process exit events and will call the supplied handler function
*/
export function final(
logger: Logger,
handler: (error: Error, finalLogger: Logger, ...args: any[]) => void,
): (error: Error | null, ...args: any[]) => void;
export function final(logger: Logger): Logger;
}

@mcollina
Copy link
Member

mcollina commented Sep 1, 2022

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
Copy link
Author

yukha-dw commented Sep 1, 2022

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
Copy link
Member

mcollina commented Sep 1, 2022

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
Copy link
Author

yukha-dw commented Sep 1, 2022

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
Copy link
Member

mcollina commented Sep 1, 2022

Here is the PR that removes it completely: #1544. Thanks for catching.

@github-actions
Copy link

github-actions bot commented Oct 2, 2022

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 github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants