Last Updated: February 25, 2016
·
487
· chrispebble

Low impact logging

With the help of tasks in .net 4.0 we can now easily write logging code doesn't block the rest of our application; helping to reduce the impact of logging to the barest minimum.

And it is as simple as:

 Task.Factory.StartNew(() => {
    // logging code
});

This will allow the logging code to finish executing asynchronously in parallel without holding up the execution of the rest of the code.