Extending Existing Loggers

In the previous section, we saw how we could create new loggers by implementing the ILogger interface and extending the Logger abstract class. The only other method to create a new logger is to extend an existing logger. We’ll now see how to accomplish this by extending the console logger. The console logger can be used as a basis for various loggers, not just those that log to the console. You may be surprised to find out that the FileLogger class extends the ConsoleLogger class! Some reasons you should consider extending this class are outlined here.

  • Ease of Creation. From the three methods listed previously for creating new loggers, extending an existing logger is the easiest method.

  • Automatic Indentation The console ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.