Skip to content

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

Description

@laicasaane

Type of issue

Other (describe below)

Description

This code example in section "Redacting sensitive information in logs" is incomplete because to get the code running, I have to hunt for the declaration of these types across multiple documents:

There is also an error in C# syntax:

  • [MyTaxonomyClassifications.Private]
    ```csharp
    [LoggerMessage(0, LogLevel.Information, "User SSN: {SSN}")]
    public static partial void LogPrivateInformation(
    this ILogger logger,
    [MyTaxonomyClassifications.Private] string SSN);
    ```

MyTaxonomyClassifications.Private is a static property inside the class MyTaxonomyClassifications thus can't be used in attribute syntax.

Correct code should be:

[LoggerMessage(0, LogLevel.Information, "User SSN: {SSN}")] 
public static partial void LogPrivateInformation( 
    this ILogger logger, 
    [PrivateInformationAttribute] string SSN); 

But PrivateInformationAttribute is current missing in this doc.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/extensions/logging/source-generation

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/extensions/logging/source-generation.md

Document Version Independent Id

443c0b98-55c6-5519-7da5-380f45076c7b

Platform Id

f655ece6-62d1-5404-329a-3c3cafa94103

Article author

gewarren

Metadata

  • ID: 697f6282-9c7f-2435-87e5-0a889a6dfcb9
  • PlatformId: f655ece6-62d1-5404-329a-3c3cafa94103
  • Service: dotnet-fundamentals

Associated WorkItem - 596911

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status
👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions