Hacker News new | ask | show | jobs
by d--b 2919 days ago
Well, I could do operations for logging that are otherwise not required...

   if(log) { logger.write(computestuff()); }
1 comments

Depending on language if you have first class functions you could also do:

  logger.write(computestuff);
Or for parameterized functions:

  logger.write(() => computestuff(a, b, c));
Then all that logging policy stuff can live with the logging and doesn't need to be checked explicitly throughout the codebase.