Closed DinoSourcesRex closed 3 weeks ago
@DinoSourcesRex , I was not able to reproduce the same issue with the code below in dotnet8, Serilog 4.0.1, Serilog.Sinks.Console 6.0.0, what is your setup?
internal class Program
{
static void Main(string[] args)
{
using var log = new LoggerConfiguration()
.Destructure.UsingAttributes()
.WriteTo.Console()
.CreateLogger();
var token = new Token("Key", "Value");
log.Information("templated: {@token}", token);
}
}
public record Token
{
public string Name { get; init; }
[NotLogged]
public string Value { get; init; }
public Token(string name, string value)
{
Name = name;
Value = value;
}
}
This issue was marked as stale since it has not been active for a long time
@mobilebilly I'm closing this! After updating some libraries everything started to work. Thanks!
Describe the bug Given the following record:
I would expect that the
Value
property is not logged, but it does get logged.Simply changing the record to a
class
type fixes this, so I feel as though this is a bug.Expected behavior I would expect that the attribute works on record types and correctly does not log the property.