![](../icons/collapse_all.gif)
![](../icons/collapse_all.gif)
![](../icons/collapse_all.gif)
If you want your application to log StreamLink .NET errors and other activity, implement the ILogger interface. The application must register the ILogger with StreamLink by setting the Logger property of the StreamLink object. The application can then use this single logger to log both StreamLink.NET library information and information originating from the application itself.
If you do not implement an ILogger, StreamLink will send any logging information it generates to the inbuilt FileLogger, provided this logger has been enabled in the StreamLink.NET configuration file (see "Activating the StreamLink.NET File Logger" in this document). If the FileLogger has not been enabled, StreamLink will send its logging information to the ConsoleLogger.
![](../icons/collapse_all.gif)
![](../icons/CopyCode.gif)
using System; using System.Collections.Generic; using System.Text; using Caplin.StreamLink; using Caplin.StreamLink.Logging; using System.Diagnostics; using Caplin.StreamLink.Authentication; namespace StreamLinkExamples.Basics { /// <summary> /// Example inner class that implements ILogger and /// a an outline of how it may be used. /// </summary> public class SettingUpALogger { /// <summary> /// Example of a class that implements ILogger and /// a an outline of how it may be used. /// </summary> public static void SettingUpALoggerExample() { StreamLink myStreamLink = new StreamLink(); // Set the logger property to start using the console logger myStreamLink.Logger = new ConsoleLogger(); } } }