fix: Add ability to log objects easily#140
Conversation
Sometimes we want to log an object, i.e. "Processing: X", but there is a lot of boilerplate involved each time, as we need to JSON.stringify the object and put the result in a template string. The `.object` method will cut the boilerplate for us.
seb-cr
left a comment
There was a problem hiding this comment.
This looks fine.
This has reminded me though, in general, I'd prefer to be able to use Logger.info (or warning or error) in the same way as console.log: passing an arbitrary number of arguments and it stringifies and logs all of them. Then your example would become simply Logger.info('Processing', X). Most loggers I've used work like that and it's a bit confusing that LambdaWrapper's works differently. I guess this would be a breaking change; something to consider for v2 maybe?
|
Yeah I think it would be a breaking change for how |
|
🎉 This PR is included in version 1.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sometimes we want to log an object, i.e. "Processing: X", but there is a
lot of boilerplate involved each time, as we need to JSON.stringify the
object and put the result in a template string.
The
.objectmethod will cut the boilerplate for us.