CA1848: Use the LoggerMessage delegates (code analysis) - .NET (original) (raw)

Property Value
Rule ID CA1848
Title Use the LoggerMessage delegates
Category Performance
Fix is breaking or non-breaking Non-breaking
Enabled by default in .NET 9 No

Cause

Use of logger extension methods, such as LogInformation and LogDebug.

Rule description

For high-performance logging scenarios, use the LoggerMessage pattern.

How to fix violations

Use LoggerMessage to fix violations of this rule.

LoggerMessage provides the following performance advantages over Logger extension methods:

When to suppress warnings

Do not suppress a warning from this rule.

See also