DebugLogListener
The DebugLogListener is the best debugging tool there is during development. It shows you insight in your application in the output window of Visual Studio, even from messages generated by Catel. To use it, use this:
#if DEBUG
LogManager.AddDebugListener();
#endif
For some platforms (like UWP), Catel uses Debug.WriteLine
which gets removed in a release build. For such platforms, it is recommended to create a customer log listener as shown below.
public class DebugLogListener : LogListenerBase
{
protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
{
if (log.IsCatelLogging && IgnoreCatelLogging)
{
return;
}
var consoleMessage = FormatLogEvent(log, message, logEvent, extraData, logData, time);
System.Diagnostics.Debug.WriteLine(consoleMessage);
}
}
Contributions
We would like to thank the following contributors:
Want to contribute to the documentation? We have a guide for that!
Questions
Have a question about Catel? Use StackOverflow with the Catel tag!