C# | Visual Basic | Visual C++ |
public interface ILogger
Public Interface ILogger
public interface class ILogger
All Members | Methods | ||||
Icon | Member | Description |
---|---|---|
Log(SourceLevels, String, String) |
Logs a single message with a given severity and category.
| |
Log(SourceLevels, String, String, array<String>[]()[]) |
Logs a single message with supplied parameter values substituted into it.
| |
Log(SourceLevels, array<String>[]()[], String) |
Logs a single message with a given severity and one or more categories.
| |
Log(SourceLevels, array<String>[]()[], String, array<String>[]()[]) |
Logs a single message with a given severity and one or more categories,
and with supplied parameter values substituted into it.
|
The class that implements ILogger can also be coded to log information originating from the application itself. In this way you can use one single logger to record information originating from both the application and the StreamLink library.
The ILogger interface defines one method named Log(SourceLevels, String, String) with various overloads. The first argument of Log() is a SourceLevels enumeration which identifies the severity of the message. The second argument is either a String identifying the category associated with the log message, or a String array that identifies several such categories. An example of a category is RawDataIn; log messages with this category contain RTTP messages. For the list of logging categories used by StreamLink, see StreamLinkLoggingCategories.
Both the SourceLevels enum and the category can be used to filter the messages in the implemented Log() methods, allowing the application to only log information relating to particular severities and/or associated categories.
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() { IStreamLink myStreamLink = new StreamLink(); // Set the logger property to start using the console logger myStreamLink.Logger = new ConsoleLogger(); } } }
The ILogger methods are not called on a dedicated worker thread. Therefore, if any of these methods are likely take a relatively long time to execute, they should be coded to run in a separate thread.