LoggerExtensions.LogWarning 方法

定义

重载

LogWarning(ILogger, String, Object[])

设置警告日志消息格式并写入该消息。

LogWarning(ILogger, EventId, String, Object[])

设置警告日志消息格式并写入该消息。

LogWarning(ILogger, Exception, String, Object[])

设置警告日志消息格式并写入该消息。

LogWarning(ILogger, EventId, Exception, String, Object[])

设置警告日志消息格式并写入该消息。

LogWarning(ILogger, String, Object[])

设置警告日志消息格式并写入该消息。

public:
[System::Runtime::CompilerServices::Extension]
 static void LogWarning(Microsoft::Extensions::Logging::ILogger ^ logger, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, string message, params object[] args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, string? message, params object?[] args);
static member LogWarning : Microsoft.Extensions.Logging.ILogger * string * obj[] -> unit
<Extension()>
Public Sub LogWarning (logger As ILogger, message As String, ParamArray args As Object())

参数

logger
ILogger

要向其中进行写入的 ILogger

message
String

采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。

示例

logger.LogWarning("Processing request from {Address}", address)

适用于

LogWarning(ILogger, EventId, String, Object[])

设置警告日志消息格式并写入该消息。

public:
[System::Runtime::CompilerServices::Extension]
 static void LogWarning(Microsoft::Extensions::Logging::ILogger ^ logger, Microsoft::Extensions::Logging::EventId eventId, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, string message, params object[] args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, string? message, params object?[] args);
static member LogWarning : Microsoft.Extensions.Logging.ILogger * Microsoft.Extensions.Logging.EventId * string * obj[] -> unit
<Extension()>
Public Sub LogWarning (logger As ILogger, eventId As EventId, message As String, ParamArray args As Object())

参数

logger
ILogger

要向其中进行写入的 ILogger

eventId
EventId

与日志关联的事件 ID。

message
String

采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。

示例

logger.LogWarning(0, "Processing request from {Address}", address)

适用于

LogWarning(ILogger, Exception, String, Object[])

设置警告日志消息格式并写入该消息。

public:
[System::Runtime::CompilerServices::Extension]
 static void LogWarning(Microsoft::Extensions::Logging::ILogger ^ logger, Exception ^ exception, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Exception exception, string message, params object[] args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Exception? exception, string? message, params object?[] args);
static member LogWarning : Microsoft.Extensions.Logging.ILogger * Exception * string * obj[] -> unit
<Extension()>
Public Sub LogWarning (logger As ILogger, exception As Exception, message As String, ParamArray args As Object())

参数

logger
ILogger

要向其中进行写入的 ILogger

exception
Exception

要记录的异常。

message
String

采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。

示例

logger.LogWarning(exception, "Error while processing request from {Address}", address)

适用于

LogWarning(ILogger, EventId, Exception, String, Object[])

设置警告日志消息格式并写入该消息。

public:
[System::Runtime::CompilerServices::Extension]
 static void LogWarning(Microsoft::Extensions::Logging::ILogger ^ logger, Microsoft::Extensions::Logging::EventId eventId, Exception ^ exception, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, Exception exception, string message, params object[] args);
public static void LogWarning (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, Exception? exception, string? message, params object?[] args);
static member LogWarning : Microsoft.Extensions.Logging.ILogger * Microsoft.Extensions.Logging.EventId * Exception * string * obj[] -> unit
<Extension()>
Public Sub LogWarning (logger As ILogger, eventId As EventId, exception As Exception, message As String, ParamArray args As Object())

参数

logger
ILogger

要向其中进行写入的 ILogger

eventId
EventId

与日志关联的事件 ID。

exception
Exception

要记录的异常。

message
String

采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。

示例

logger.LogWarning(0, exception, "Error while processing request from {Address}", address)

适用于