LoggerMessage Class

Creates delegates which can be later cached to log messages in a performant way.

Namespace
Microsoft.Extensions.Logging
Assemblies
  • Microsoft.Extensions.Logging.Abstractions

Syntax

public class LoggerMessage
class Microsoft.Extensions.Logging.LoggerMessage

Methods

Define(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, Exception> Define(LogLevel logLevel, EventId eventId, string formatString)
DefineScope(System.String)

Creates a delegate which can be invoked to create a log scope.

Arguments:formatString (System.String) – The named format string
Return type:System.Func<Microsoft.Extensions.Logging.ILogger>
Returns:A delegate which when invoked creates a log scope.
public static Func<ILogger, IDisposable> DefineScope(string formatString)
DefineScope<T1>(System.String)

Creates a delegate which can be invoked to create a log scope.

Arguments:formatString (System.String) – The named format string
Return type:System.Func<Microsoft.Extensions.Logging.ILogger>
Returns:A delegate which when invoked creates a log scope.
public static Func<ILogger, T1, IDisposable> DefineScope<T1>(string formatString)
DefineScope<T1, T2>(System.String)

Creates a delegate which can be invoked to create a log scope.

Arguments:formatString (System.String) – The named format string
Return type:System.Func<Microsoft.Extensions.Logging.ILogger>
Returns:A delegate which when invoked creates a log scope.
public static Func<ILogger, T1, T2, IDisposable> DefineScope<T1, T2>(string formatString)
DefineScope<T1, T2, T3>(System.String)

Creates a delegate which can be invoked to create a log scope.

Arguments:formatString (System.String) – The named format string
Return type:System.Func<Microsoft.Extensions.Logging.ILogger>
Returns:A delegate which when invoked creates a log scope.
public static Func<ILogger, T1, T2, T3, IDisposable> DefineScope<T1, T2, T3>(string formatString)
Define<T1>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, Exception> Define<T1>(LogLevel logLevel, EventId eventId, string formatString)
Define<T1, T2>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, T2, Exception> Define<T1, T2>(LogLevel logLevel, EventId eventId, string formatString)
Define<T1, T2, T3>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, T2, T3, Exception> Define<T1, T2, T3>(LogLevel logLevel, EventId eventId, string formatString)
Define<T1, T2, T3, T4>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, T2, T3, T4, Exception> Define<T1, T2, T3, T4>(LogLevel logLevel, EventId eventId, string formatString)
Define<T1, T2, T3, T4, T5>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, T2, T3, T4, T5, Exception> Define<T1, T2, T3, T4, T5>(LogLevel logLevel, EventId eventId, string formatString)
Define<T1, T2, T3, T4, T5, T6>(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, System.String)

Creates a delegate which can be invoked for logging a message.

Arguments:
Return type:

System.Action<Microsoft.Extensions.Logging.ILogger>

Returns:

A delegate which when invoked creates a log message.

public static Action<ILogger, T1, T2, T3, T4, T5, T6, Exception> Define<T1, T2, T3, T4, T5, T6>(LogLevel logLevel, EventId eventId, string formatString)