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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.