LaunchDarkly Dotnet Client SDK
Search Results for

    Show / Hide Table of Contents

    Class ILogAdapterExtensions

    Extension methods that can be applied to any ILogAdapter.

    Inheritance
    object
    ILogAdapterExtensions
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LaunchDarkly.Logging
    Assembly: LaunchDarkly.Logging.dll
    Syntax
    public static class ILogAdapterExtensions

    Methods

    Level(ILogAdapter, LogLevel)

    Disables log output below the specified level.

    Declaration
    public static ILogAdapter Level(this ILogAdapter adapter, LogLevel minimumLevel)
    Parameters
    Type Name Description
    ILogAdapter adapter
    LogLevel minimumLevel
    Returns
    Type Description
    ILogAdapter

    an ILogAdapter that wraps the original one but filters out log messages of lower levels

    Remarks

    This is a decorator that can be applied to any ILogAdapter, either one of the standard ones available in Logs or a custom implementation. Any log messages for a lower level will be immediately discarded; all others will be forwarded to the underlying logging implementation (which may also have other filtering rules of its own).

    Examples

    // This one will write all log messages to Console.Error, including Debug messages var unfilteredLogging = Logs.ToConsole;

    // This one will write only Warn and Error messages var filteredLogging = Logs.ToConsole.Level(Warn);

    Logger(ILogAdapter, string)

    Convenience method for creating logger instances.

    Declaration
    public static Logger Logger(this ILogAdapter adapter, string name)
    Parameters
    Type Name Description
    ILogAdapter adapter

    the ILogAdapter that provides the underlying implementation of logging

    string name

    the name for this logger

    Returns
    Type Description
    Logger

    a logger instance

    Remarks

    This is a shortcut for calling WithAdapter(ILogAdapter, string). Application code will not normally use this method; it is used by library code to set up individual named loggers that a library will log to.

    In this article
    Back to top Generated by DocFX