3 ms·
Logger as an anonymous function. I think literally every logger let's you log at a certain point as a single line that does not cover the context of the log.
by mekster 7y ago
Logger as an anonymous function.
I think literally every logger let's you log at a certain point as a single line that does not cover the context of the log.
logger.info('Doing this and that', function () {
do_this()
if(maybe) do_that()
})
This way you know how much the log comment is supposed to cover as well as take a benchmark on the said context.
I can never think to just add a single line logger anymore.
This is much better than inserting comments in a code as comments can have no context except the line below.
You can add a function like,
logger.comment
and don't let it log anything to be comment syntax replacement.
- stevenroose 7y agoNot an active HN user. There doesn't seem to be a downvote function..
- mekster 7y agoI guess you can't downvote having below 500 points for yourself. You can certainly add a comment on how you don't like it.