Listeners are a way to get information about the cops and their rules in the framework. The *ApiCopManager* will take care of all the retrieval of the results and the registration of the cops. The registered listeners are used by the *ApiCopManager.WriteResults* method to write the output to. To add a listener and be able to see the output of the *ApiCop* feature, use the following code:

var apiCopListener = new ConsoleApiCopListener();

After the listeners are added, one can call ApiCopManager.WriteResults:


Customizing grouping

It is possible to group the listeners. To specify the grouping, use the following code:

var apiCopListener = new ConsoleApiCopListener();
apiCopListener.Grouping = ApiCopListenerGrouping.Rule;

The following grouping options are available:

Grouping name|Description -|- Cop|Sort by the name of the class in which the cop is registered. Rule|Sort by the rule name. Tag|Sort by tag, which is dependent on the rule implementation. It is recommended though to use the final class name as tag.

Creating custom listeners

Catel provides several listeners out of the box. To create custom listeners, the only requirement is to implement the IApiCopListener. To make it easier to create custom listeners (such as an HTML listener), Catel provides the following base classes which can also be used as a base for custom listeners:



Have a question about Catel? Use StackOverflow with the Catel tag!