LoggerMessageAttribute Constructors

Definition

Overloads

LoggerMessageAttribute()

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

LoggerMessageAttribute(LogLevel)

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

LoggerMessageAttribute(String)

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

LoggerMessageAttribute(LogLevel, String)

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

LoggerMessageAttribute(Int32, LogLevel, String)

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

LoggerMessageAttribute()

Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

C#
public LoggerMessageAttribute();

Applies to

.NET 10 (package-provided) 及其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

LoggerMessageAttribute(LogLevel)

Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

C#
public LoggerMessageAttribute(Microsoft.Extensions.Logging.LogLevel level);

Parameters

level
LogLevel

The log level.

Applies to

.NET 10 (package-provided) 及其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

LoggerMessageAttribute(String)

Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

C#
public LoggerMessageAttribute(string message);

Parameters

message
String

Format string of the log message.

Applies to

.NET 10 (package-provided) 及其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

LoggerMessageAttribute(LogLevel, String)

Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

C#
public LoggerMessageAttribute(Microsoft.Extensions.Logging.LogLevel level, string message);

Parameters

level
LogLevel

The log level.

message
String

Format string of the log message.

Applies to

.NET 10 (package-provided) 及其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

LoggerMessageAttribute(Int32, LogLevel, String)

Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs
Source:
LoggerMessageAttribute.cs

Initializes a new instance of the LoggerMessageAttribute class that's used to guide the production of a strongly typed logging method.

C#
public LoggerMessageAttribute(int eventId, Microsoft.Extensions.Logging.LogLevel level, string message);

Parameters

eventId
Int32

The log event ID.

level
LogLevel

The log level.

message
String

Format string of the log message.

Applies to

.NET 10 (package-provided) 及其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)