LoggerExtensions.LogError 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
LogError(ILogger, EventId, Exception, String, Object[]) |
设置错误日志消息格式并写入该消息。 |
LogError(ILogger, Exception, String, Object[]) |
设置错误日志消息格式并写入该消息。 |
LogError(ILogger, EventId, String, Object[]) |
设置错误日志消息格式并写入该消息。 |
LogError(ILogger, String, Object[]) |
设置错误日志消息格式并写入该消息。 |
LogError(ILogger, EventId, Exception, String, Object[])
设置错误日志消息格式并写入该消息。
public:
[System::Runtime::CompilerServices::Extension]
static void LogError(Microsoft::Extensions::Logging::ILogger ^ logger, Microsoft::Extensions::Logging::EventId eventId, Exception ^ exception, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, Exception exception, string message, params object[] args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, Exception? exception, string? message, params object?[] args);
static member LogError : Microsoft.Extensions.Logging.ILogger * Microsoft.Extensions.Logging.EventId * Exception * string * obj[] -> unit
<Extension()>
Public Sub LogError (logger As ILogger, eventId As EventId, exception As Exception, message As String, ParamArray args As Object())
参数
- eventId
- EventId
与日志关联的事件 ID。
- exception
- Exception
要记录的异常。
- message
- String
采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”
- args
- Object[]
一个对象数组,其中包含零个或多个要设置格式的对象。
示例
logger.LogError(0, exception, "Error while processing request from {Address}", address)
适用于
LogError(ILogger, Exception, String, Object[])
设置错误日志消息格式并写入该消息。
public:
[System::Runtime::CompilerServices::Extension]
static void LogError(Microsoft::Extensions::Logging::ILogger ^ logger, Exception ^ exception, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Exception exception, string message, params object[] args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Exception? exception, string? message, params object?[] args);
static member LogError : Microsoft.Extensions.Logging.ILogger * Exception * string * obj[] -> unit
<Extension()>
Public Sub LogError (logger As ILogger, exception As Exception, message As String, ParamArray args As Object())
参数
- exception
- Exception
要记录的异常。
- message
- String
采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”
- args
- Object[]
一个对象数组,其中包含零个或多个要设置格式的对象。
示例
logger.LogError(exception, "Error while processing request from {Address}", address)
适用于
LogError(ILogger, EventId, String, Object[])
设置错误日志消息格式并写入该消息。
public:
[System::Runtime::CompilerServices::Extension]
static void LogError(Microsoft::Extensions::Logging::ILogger ^ logger, Microsoft::Extensions::Logging::EventId eventId, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, string message, params object[] args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, string? message, params object?[] args);
static member LogError : Microsoft.Extensions.Logging.ILogger * Microsoft.Extensions.Logging.EventId * string * obj[] -> unit
<Extension()>
Public Sub LogError (logger As ILogger, eventId As EventId, message As String, ParamArray args As Object())
参数
- eventId
- EventId
与日志关联的事件 ID。
- message
- String
采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”
- args
- Object[]
一个对象数组,其中包含零个或多个要设置格式的对象。
示例
logger.LogError(0, "Processing request from {Address}", address)
适用于
LogError(ILogger, String, Object[])
设置错误日志消息格式并写入该消息。
public:
[System::Runtime::CompilerServices::Extension]
static void LogError(Microsoft::Extensions::Logging::ILogger ^ logger, System::String ^ message, ... cli::array <System::Object ^> ^ args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, string message, params object[] args);
public static void LogError (this Microsoft.Extensions.Logging.ILogger logger, string? message, params object?[] args);
static member LogError : Microsoft.Extensions.Logging.ILogger * string * obj[] -> unit
<Extension()>
Public Sub LogError (logger As ILogger, message As String, ParamArray args As Object())
参数
- message
- String
采用消息模板格式的日志消息的格式字符串。 示例: “从 {Address} 登录的用户 {User}”
- args
- Object[]
一个对象数组,其中包含零个或多个要设置格式的对象。
示例
logger.LogError("Processing request from {Address}", address)