LoggerExtensions.LogCritical 方法

定义

重载

LogCritical(ILogger, String, Object[])

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

LogCritical(ILogger, String, Object[])

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

参数

logger
ILogger

要向其中进行写入的 ILoggerThe ILogger to write to.

message
String

采用消息模板格式的日志消息的格式字符串。Format string of the log message in message template format. 示例:Example: "User {User} logged in from {Address}"

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。An object array that contains zero or more objects to format.

示例

记录器.LogCritical ("处理来自 {Address} 的请求",地址)logger.LogCritical("Processing request from {Address}", address)

适用于

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

参数

logger
ILogger

要向其中进行写入的 ILoggerThe ILogger to write to.

eventId
EventId

与日志关联的事件 ID。The event id associated with the log.

message
String

采用消息模板格式的日志消息的格式字符串。Format string of the log message in message template format. 示例:Example: "User {User} logged in from {Address}"

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。An object array that contains zero or more objects to format.

示例

记录器.LogCritical (0,"处理来自 {Address} 的请求",地址)logger.LogCritical(0, "Processing request from {Address}", address)

适用于

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

参数

logger
ILogger

要向其中进行写入的 ILoggerThe ILogger to write to.

exception
Exception

要记录的异常。The exception to log.

message
String

采用消息模板格式的日志消息的格式字符串。Format string of the log message in message template format. 示例:Example: "User {User} logged in from {Address}"

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。An object array that contains zero or more objects to format.

示例

记录器.LogCritical (异常,"处理来自 {Address} 的请求时出错",地址)logger.LogCritical(exception, "Error while processing request from {Address}", address)

适用于

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

设置关键日志消息格式并写入该消息。Formats and writes a critical log message.

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

参数

logger
ILogger

要向其中进行写入的 ILoggerThe ILogger to write to.

eventId
EventId

与日志关联的事件 ID。The event id associated with the log.

exception
Exception

要记录的异常。The exception to log.

message
String

采用消息模板格式的日志消息的格式字符串。Format string of the log message in message template format. 示例:Example: "User {User} logged in from {Address}"

args
Object[]

一个对象数组,其中包含零个或多个要设置格式的对象。An object array that contains zero or more objects to format.

示例

记录器.LogCritical (0,exception,"处理来自 {Address} 的请求时出错",地址)logger.LogCritical(0, exception, "Error while processing request from {Address}", address)

适用于