Show / Hide Table of Contents

    Class ApplicationInsightsLoggerDecorator

    A logger decorator that writes to a instance.

    Inheritance
    System.Object
    ApplicationInsightsLoggerDecorator
    Namespace: Copper.Diagnostics.Common.Logging
    Assembly: Copper.Diagnostics.Common.dll
    Syntax
    public class ApplicationInsightsLoggerDecorator : ILogger

    Constructors

    View Source

    ApplicationInsightsLoggerDecorator(TelemetryClient, ILogger)

    Initializes a new instance of the ApplicationInsightsLoggerDecorator class.

    Declaration
    public ApplicationInsightsLoggerDecorator(TelemetryClient telemetryClient, ILogger innerLogger)
    Parameters
    Type Name Description
    TelemetryClient telemetryClient

    The telemetry client.

    ILogger innerLogger

    The inner logger.

    Methods

    View Source

    BeginScope<TState>(TState)

    Begins a logical operation scope.

    Declaration
    public IDisposable BeginScope<TState>(TState state)
    Parameters
    Type Name Description
    TState state

    The identifier for the scope.

    Returns
    Type Description
    System.IDisposable

    An System.IDisposable that ends the logical operation scope on dispose.

    Type Parameters
    Name Description
    TState

    The type of the state to begin scope for.

    View Source

    IsEnabled(LogLevel)

    Checks if the given logLevel is enabled.

    Declaration
    public bool IsEnabled(LogLevel logLevel)
    Parameters
    Type Name Description
    System.LogLevel logLevel

    level to be checked.

    Returns
    Type Description
    System.Boolean

    true if enabled.

    View Source

    Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, String>)

    Writes a log entry.

    Declaration
    public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
    Parameters
    Type Name Description
    System.LogLevel logLevel

    Entry will be written on this level.

    EventId eventId

    Id of the event.

    TState state

    The entry to be written. Can be also an object.

    System.Exception exception

    The exception related to this entry.

    System.Func<TState, System.Exception, System.String> formatter

    Function to create a System.String message of the state and exception.

    Type Parameters
    Name Description
    TState

    The type of the object to be written.

    • View Source
    Back to top Generated by DocFX