Table of Contents

Class MicrosoftExtensionsLoggingLogger

Namespace
Splat.Microsoft.Extensions.Logging
Assembly
Splat.Microsoft.Extensions.Logging.dll

Provides an adapter that wraps a Microsoft.Extensions.Logging.ILogger instance for use with the ILogger interface.

public sealed class MicrosoftExtensionsLoggingLogger : ILogger
Inheritance
MicrosoftExtensionsLoggingLogger
Implements
ILogger
Extension Methods

Remarks

This class enables integration between components expecting an ILogger implementation and the Microsoft.Extensions.Logging infrastructure. It delegates all logging operations to the underlying Microsoft.Extensions.Logging.ILogger instance supplied at construction. Thread safety and log level filtering are determined by the behavior of the wrapped logger.

Constructors

MicrosoftExtensionsLoggingLogger(ILogger)

Initializes a new instance of the MicrosoftExtensionsLoggingLogger class.

public MicrosoftExtensionsLoggingLogger(ILogger inner)

Parameters

inner ILogger

The Microsoft.Extensions.Logging logger instance to wrap.

Properties

Level

Gets the level at which the target will emit messages.

public LogLevel Level { get; }

Property Value

LogLevel

Methods

Write(Exception, string, LogLevel)

Writes a message to the target.

public void Write(Exception exception, string message, LogLevel logLevel)

Parameters

exception Exception

The exception that occurred.

message string

The message to write.

logLevel LogLevel

The severity level of the log message.

Write(Exception, string, Type, LogLevel)

Writes a message to the target.

public void Write(Exception exception, string message, Type type, LogLevel logLevel)

Parameters

exception Exception

The exception that occurred.

message string

The message to write.

type Type

The type associated with the log message.

logLevel LogLevel

The severity level of the log message.

Write(string, LogLevel)

Writes a message to the target.

public void Write(string message, LogLevel logLevel)

Parameters

message string

The message to write.

logLevel LogLevel

The severity level of the log message.

Write(string, Type, LogLevel)

Writes a message to the target.

public void Write(string message, Type type, LogLevel logLevel)

Parameters

message string

The message to write.

type Type

The type associated with the log message.

logLevel LogLevel

The severity level of the log message.