LoggerExtensions.LogCritical Method

Definition

Overloads

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[])

Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs

Formats and writes a critical log message.

public static void LogCritical (this Microsoft.Extensions.Logging.ILogger logger, string? message, params object?[] args);

Parameters

logger
ILogger

The 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.

Examples

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs

Formats and writes a critical log message.

public static void LogCritical (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, string? message, params object?[] args);

Parameters

logger
ILogger

The ILogger to write to.

eventId
EventId

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.

Examples

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs

Formats and writes a critical log message.

public static void LogCritical (this Microsoft.Extensions.Logging.ILogger logger, Exception? exception, string? message, params object?[] args);

Parameters

logger
ILogger

The 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.

Examples

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

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

Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs
Source:
LoggerExtensions.cs

Formats and writes a critical log message.

public static void LogCritical (this Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.EventId eventId, Exception? exception, string? message, params object?[] args);

Parameters

logger
ILogger

The ILogger to write to.

eventId
EventId

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.

Examples

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)