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
Drop support for printf style logging because once again i deployed logger.info(msg, obj) instead of logger.info(obj, msg) to prod and cant debug prod.
#2033
Open
Raynos opened this issue
Aug 21, 2024
· 2 comments
Would you accept a pull request for a breaking change where we drop varags on the LogFn and do not support printf style logging.
// this is fine
logger.info('a message')
// this is good. I wont bike shed about how the arguments should be swapped like bunyan and the rest.
logger.info({
something: 'happened'
}, 'a more descriptive image.
// This is horrible.
logger.info('oh hi %s', 'bye')
The issue I'm running into is that when I do the following
logger.info('a msg', { ... })
it's not a typescript error, because its technically an invalid printf expression and the vargs of ...any[] in the type signature makes the pino api basically untyped.
I want to make it harder for me to deploy broken log statements to prod when i swapped the arguments by accident and didnt catch it in review.
I'm happy to do the pull request, and of course it would be a major version.
The text was updated successfully, but these errors were encountered:
That hook doesn't help at all with the typescript definitions. Currently i cast the logger to an interface with a stricter type definition. But really it's a footgun for everyone.
Would you accept a pull request for a breaking change where we drop varags on the LogFn and do not support printf style logging.
The issue I'm running into is that when I do the following
logger.info('a msg', { ... })
it's not a typescript error, because its technically an invalid printf expression and the vargs of ...any[] in the type signature makes the pino api basically untyped.
I want to make it harder for me to deploy broken log statements to prod when i swapped the arguments by accident and didnt catch it in review.
I'm happy to do the pull request, and of course it would be a major version.
The text was updated successfully, but these errors were encountered: