Noncompliant Code Example:
class User
{
public int Age { get; set; }
}
...
Log.Information("The user is {MyUser}", new User());Compliant Solution:
class User
{
public int Age { get; set; }
}
...
Log.Information("The user is {@MyUser}", new User());
// or
Log.Information("The user is {$MyUser}", new User());Also applies to custom logging wrappers.
Does not apply to ZLogger 2.x interpolated templates: destructuring is Serilog syntax,
ZLogger serializes a value with the :json format specifier instead.