Search Results for

    Show / Hide Table of Contents

    Class LogProvider

    Base class for all logging provider implementations.

    Inheritance
    System.Object
    LogProvider
    DebugLogProvider
    LogEventLogProvider
    LogStashLogProvider
    NullLogProvider
    SyslogLogProvider
    TextBlockLogProvider
    TextLogProvider
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public abstract class LogProvider : object

    Constructors

    LogProvider()

    Initializes a new instance of the LogProvider class using DefaultLogLevel as the log level.

    Declaration
    public LogProvider()

    Properties

    Filter

    Gets or sets a filter on the log provider. Returning true will log the event, while returning false will skip it.

    Declaration
    public Function1<LogEvent, bool> Filter { get; set; }
    Property Value
    Type Description
    Function1<LogEvent, System.Boolean>

    Level

    Gets or sets the log level.

    Declaration
    public LogLevel Level { get; set; }
    Property Value
    Type Description
    LogLevel

    ProcessId

    Gets the current process id.

    Declaration
    protected int ProcessId { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    DoLog(LogEvent)

    Logs a message at the specified log level.

    Declaration
    protected abstract void DoLog(LogEvent logEvent)
    Parameters
    Type Name Description
    LogEvent logEvent

    The log event details.

    GenerateLogLine(LogEvent)

    Generates a default log line.

    Declaration
    protected virtual string GenerateLogLine(LogEvent logEvent)
    Parameters
    Type Name Description
    LogEvent logEvent

    The log event details.

    Returns
    Type Description
    System.String

    GetLogLevelString(LogLevel)

    Converts a log-level to a 5-character string for consistently-spaced character sequences.

    Declaration
    public static string GetLogLevelString(LogLevel level)
    Parameters
    Type Name Description
    LogLevel level

    The log level.

    Returns
    Type Description
    System.String

    The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.

    GetPrefix(LogLevel, Boolean)

    Converts a log-level to a 5-character string for consistently-spaced character sequences.

    Declaration
    protected string GetPrefix(LogLevel level, bool includeTimestamp)
    Parameters
    Type Name Description
    LogLevel level

    The log level.

    System.Boolean includeTimestamp

    Whether to include a timestamp in the prefix.

    Returns
    Type Description
    System.String

    The log level as an upper-case string with right-side whitespace padding to ensure a 5-character sequence.

    GetPrefixTimestamp(DateTime)

    Converts a timestamp to an ISO-8601-formatted string for rendering in a log message (YYYY-MM-DDThh:mm:ss.sssZ).

    Declaration
    public static string GetPrefixTimestamp(DateTime timestamp)
    Parameters
    Type Name Description
    DateTime timestamp

    The timestamp.

    Returns
    Type Description
    System.String

    The timestamp as a formatted string.

    GetProduct()

    Returns the name of the current product.

    Declaration
    public static string GetProduct()
    Returns
    Type Description
    System.String

    Log(LogEvent)

    Log a message.

    Declaration
    public void Log(LogEvent logEvent)
    Parameters
    Type Name Description
    LogEvent logEvent

    The log event details.

    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0