Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions LogRedactionDemo.SimpleWorker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,12 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
}
}

public class User
{
public User(string Id, string Name, string Email)
{
this.Id = Id;
this.Name = Name;
this.Email = Email;
}

public string Id { get; }

[PersonalData] public string Name { get; }

[PersonalData] public string Email { get; }
}
public record User(string Id, [PersonalData] string Name, [PersonalData] string Email);

// logging code that logs the user
public static partial class Log
{
[LoggerMessage(LogLevel.Information, "User {User} logged in")]
[LoggerMessage(LogLevel.Information, "User logged in")]
public static partial void UserLoggedIn(this ILogger logger, [LogProperties] User user);
}

Expand All @@ -78,4 +64,4 @@ public class PersonalDataAttribute : DataClassificationAttribute
public PersonalDataAttribute() : base(new DataClassification("MyTaxonomy", "MyClassification"))
{
}
}
}