Skip to content

Fix redacting log article: pushed code out to snippets and added missing classes#55006

Open
adegeo wants to merge 6 commits into
mainfrom
adegeo/54570/logging
Open

Fix redacting log article: pushed code out to snippets and added missing classes#55006
adegeo wants to merge 6 commits into
mainfrom
adegeo/54570/logging

Conversation

@adegeo

@adegeo adegeo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pushed code from inline to snippets.
  • Added missing information that were declared in other articles.

Fixes #54570


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/logging/source-generation.md Compile-time logging source generation

Copilot AI review requested due to automatic review settings July 23, 2026 18:21
@adegeo
adegeo requested review from a team and gewarren as code owners July 23, 2026 18:21
@dotnetrepoman dotnetrepoman Bot added this to the July 2026 milestone Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with :::code snippet 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).

Comment thread docs/core/extensions/logging/source-generation.md Outdated
Comment thread docs/core/extensions/logging/source-generation.md Outdated
@@ -0,0 +1,12 @@
#pragma warning disable CS0105 // Using directive appeared previously in this namespace
// <CommonUsings>
using Microsoft.Extensions.Logging;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this one is repeated, maybe omit it here and just put it inline in the Markdown.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's your article 😁

adegeo and others added 3 commits July 23, 2026 15:11
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete code example and error in "Redacting sensitive information in logs"

3 participants