Fix redacting log article: pushed code out to snippets and added missing classes#55006
Open
adegeo wants to merge 6 commits into
Open
Fix redacting log article: pushed code out to snippets and added missing classes#55006adegeo wants to merge 6 commits into
adegeo wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the compile-time logging source-generation article to use external snippet files (instead of inline code blocks) and fixes the “Redacting sensitive information in logs” example by including the previously missing supporting types in the snippet source.
Changes:
- Replaced multiple inline C# examples in
source-generation.mdwith:::codesnippet references. - Added a new C# snippets project and extracted example code into dedicated snippet files.
- Added supporting redaction and data-classification types to make the redaction example self-contained.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/core/extensions/logging/source-generation.md | Replaces inline examples with snippet references, including the redaction section. |
| docs/core/extensions/logging/snippets/source-generation/csharp/csharp.csproj | Adds a snippet project to compile the extracted examples. |
| docs/core/extensions/logging/snippets/source-generation/csharp/Program.cs | Adds a minimal entry point for the snippets project. |
| docs/core/extensions/logging/snippets/source-generation/csharp/BasicUsage/StaticLog.cs | Adds snippet source for basic static LoggerMessage usage. |
| docs/core/extensions/logging/snippets/source-generation/csharp/BasicUsage/ExtensionLog.cs | Adds snippet source for extension-method LoggerMessage usage. |
| docs/core/extensions/logging/snippets/source-generation/csharp/BasicUsage/InstanceLog.cs | Adds snippet source for instance/field-based logger usage. |
| docs/core/extensions/logging/snippets/source-generation/csharp/BasicUsage/PrimaryCtorLog.cs | Adds snippet source for primary-constructor logger usage. |
| docs/core/extensions/logging/snippets/source-generation/csharp/BasicUsage/DynamicLog.cs | Adds snippet source for dynamic log level usage. |
| docs/core/extensions/logging/snippets/source-generation/csharp/LogMethodAnatomy/LogMethods.cs | Adds snippet source for a “valid log method” example. |
| docs/core/extensions/logging/snippets/source-generation/csharp/LogMethodAnatomy/IndeterminateOrder.cs | Adds snippet source for indeterminate parameter ordering example. |
| docs/core/extensions/logging/snippets/source-generation/csharp/LogMethodAnatomy/CaseInsensitiveExample.cs | Adds snippet source for case-insensitive template name support example. |
| docs/core/extensions/logging/snippets/source-generation/csharp/MoreLoggingExamples/LoggingSample.cs | Adds snippet source for additional logging examples section. |
| docs/core/extensions/logging/snippets/source-generation/csharp/RedactingSensitiveInformation/RedactionSetup.cs | Adds self-contained redaction setup snippet (taxonomy, attribute, and redactor). |
gewarren
approved these changes
Jul 23, 2026
| @@ -0,0 +1,12 @@ | |||
| #pragma warning disable CS0105 // Using directive appeared previously in this namespace | |||
| // <CommonUsings> | |||
| using Microsoft.Extensions.Logging; | |||
Collaborator
There was a problem hiding this comment.
Since this one is repeated, maybe omit it here and just put it inline in the Markdown.
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
gewarren
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #54570
Internal previews