You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
@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).
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
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.
The text was updated successfully, but these errors were encountered: