dotnet / dotnet/docs

Mention LoggerMessageAttribute on the page of rule CA1848

Open
#35,017 0 comments 0 reactions 0 assignees View on GitHub
dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

> Instead of using the [LoggerMessage class](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loggermessage) to create high-performance logs, you can use the [LoggerMessage attribute](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loggermessageattribute) in .NET 6.0. The LoggerMessageAttribute provides source-generation logging support designed to deliver a highly usable and highly performant logging solution for modern .NET applications. For more information, see [Compile-time logging source generation (.NET Fundamentals)](https://learn.microsoft.com/en-us/dotnet/core/extensions/logger-message-generator).

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 963ffcee-06de-68ab-d920-f92528f1cded
* Version Independent ID: c3a759df-f039-53ca-46d7-4c7621c1491e
* Content: [CA1848: Use the LoggerMessage delegates (code analysis) - .NET](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1848)
* Content Source: [docs/fundamentals/code-analysis/quality-rules/ca1848.md](https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca1848.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @Youssef1313
* Microsoft Alias: **gewarren**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.