Table of Contents

Class LoggerMessage

Namespace
Microsoft.Extensions.Logging
Assembly
Microsoft.Extensions.Logging.Abstractions.dll

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

public static class LoggerMessage
Inheritance
LoggerMessage
Inherited Members

Methods

Define(LogLevel, EventId, string)

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

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

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, Exception>

A delegate which when invoked creates a log message.

DefineScope(string)

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

public static Func<ILogger, IDisposable> DefineScope(string formatString)

Parameters

formatString string

The named format string

Returns

Func<ILogger, IDisposable>

A delegate which when invoked creates a log scope.

DefineScope<T1>(string)

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

public static Func<ILogger, T1, IDisposable> DefineScope<T1>(string formatString)

Parameters

formatString string

The named format string

Returns

Func<ILogger, T1, IDisposable>

A delegate which when invoked creates a log scope.

Type Parameters

T1

The type of the first parameter passed to the named format string.

DefineScope<T1, T2>(string)

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

public static Func<ILogger, T1, T2, IDisposable> DefineScope<T1, T2>(string formatString)

Parameters

formatString string

The named format string

Returns

Func<ILogger, T1, T2, IDisposable>

A delegate which when invoked creates a log scope.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

DefineScope<T1, T2, T3>(string)

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

public static Func<ILogger, T1, T2, T3, IDisposable> DefineScope<T1, T2, T3>(string formatString)

Parameters

formatString string

The named format string

Returns

Func<ILogger, T1, T2, T3, IDisposable>

A delegate which when invoked creates a log scope.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

T3

The type of the third parameter passed to the named format string.

Define<T1>(LogLevel, EventId, string)

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

public static Action<ILogger, T1, Exception> Define<T1>(LogLevel logLevel, EventId eventId, string formatString)

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

Define<T1, T2>(LogLevel, EventId, string)

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

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

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, T2, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

Define<T1, T2, T3>(LogLevel, EventId, string)

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

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

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, T2, T3, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

T3

The type of the third parameter passed to the named format string.

Define<T1, T2, T3, T4>(LogLevel, EventId, string)

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

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

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, T2, T3, T4, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

T3

The type of the third parameter passed to the named format string.

T4

The type of the fourth parameter passed to the named format string.

Define<T1, T2, T3, T4, T5>(LogLevel, EventId, string)

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

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

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, T2, T3, T4, T5, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

T3

The type of the third parameter passed to the named format string.

T4

The type of the fourth parameter passed to the named format string.

T5

The type of the fifth parameter passed to the named format string.

Define<T1, T2, T3, T4, T5, T6>(LogLevel, EventId, string)

Creates a delegate which can be invoked for logging a 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)

Parameters

logLevel LogLevel

The LogLevel

eventId EventId

The event id

formatString string

The named format string

Returns

Action<ILogger, T1, T2, T3, T4, T5, T6, Exception>

A delegate which when invoked creates a log message.

Type Parameters

T1

The type of the first parameter passed to the named format string.

T2

The type of the second parameter passed to the named format string.

T3

The type of the third parameter passed to the named format string.

T4

The type of the fourth parameter passed to the named format string.

T5

The type of the fifth parameter passed to the named format string.

T6

The type of the sixth parameter passed to the named format string.