Creating Custom Loggers

There are three ways to create a new custom logger:

  1. Implement the ILogger interface

  2. Extend the abstract Microsoft.Build.Utilities.Logger class

  3. Extend an existing logger

In Figure 5-3, we showed the ILogger interface, which all loggers must implement. The abstract Logger class has been provided to serve as a base class for new loggers. This class implements all the requirements of the ILogger interface except overriding the Initialize method, which is left to subclasses. The third option is most likely the simplest; all you have to do is extend an existing logger and override a specific behavior. We will see how to utilize all three methods in this chapter.

We will first take a look at implementing the ILogger interface. We previously ...

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.