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

Move to named parameters #1577

Open
jsumners opened this issue Oct 20, 2022 · 1 comment
Open

Move to named parameters #1577

jsumners opened this issue Oct 20, 2022 · 1 comment

Comments

@jsumners
Copy link
Member

jsumners commented Oct 20, 2022

We should move to named parameter functions in the next release. For example, with #1576 we tacked on another parameter to the level-change event:

pino/docs/api.md

Lines 1027 to 1032 in 085401b

logger.on('level-change', function (lvl, val, prevLvl, prevVal, instance) {
if (logger !== instance) {
return
}
console.log('%s (%d) was changed to %s (%d)', prevLvl, prevVal, lvl, val)
})

While the function signature of an event listener is easier to understand than one someone invokes themselves, I still think named parameters is a better experience.

@jsumners
Copy link
Member Author

jsumners commented Nov 3, 2022

@debadutta98 I'm sorry. I didn't realize @mcollina had marked this a good first issue. Still, as noted in #1583, this issue is not just about the single level-change signature. We need to scour the code for all functions have difficult signatures and update them where feasible (noting that it may not be feasible in certain hot paths due to destructuring perf penalties; in which case we should document the code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants