StreamLink.NET
ILogger Interface
StreamLink.NETCaplin.StreamLinkILogger
Definition of the interface that will receive logging messages from StreamLink.NET.
Declaration Syntax
C#Visual BasicVisual C++
public interface ILogger
Public Interface ILogger
public interface class ILogger
Members
All MembersMethods



IconMemberDescription
Log(SourceLevels, String, String)
Logs a single message with a given severity and category.

Log(SourceLevels, String, String, array<String>[]()[])
Logs a single message.

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>[]()[])
Called to inform the logger to log a message. A level is provided to indicate the severity of the message, a number of categories are provided to identify the components or the types of message being logged in addition to the message and msgParts.

Remarks
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 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.NET library.

The ILogger interface defines one method named Log(SourceLevels, String, String) with various overloads. The first parameter of Log() is a Microsoft .NET SourceLevels enum which identifies the severity of the message. The second parameter is either a String identifying the category associated with the log message, or a [!:String[]] that identifies several such categories. An example of a category is RawData; log messages with this category contain RTTP messages. For the list of logging categories, see LoggingCategories.

Both the SourceLevels enum and the category can be used to filter the messages allowing the user to log only information relating to severity and/or an associated category.

CopyC#
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();
        }
    }
}
Thread Safety

The ILogger methods are not called on a dedicated worker thread. Therefore if the logger is likely to perform any sort of intense execution it is recommended that the API user executes this in a separate thread.

Assembly: Caplin.StreamLink (Module: Caplin.StreamLink) Version: 5.0.5.0 (5.0.5.0)