Skip to content

Specify how complex types are logged to Serilog by excluding individual properties.

License

Notifications You must be signed in to change notification settings

thrixton/by-ignoring

 
 

Repository files navigation

Destructurama.ByIgnoring

Build status

Specify how complex types are logged to Serilog by excluding individual properties.

Install from NuGet:

Install-Package Destructurama.ByIgnoring

Mark properties to ignore on target types:

Log.Logger = new LoggerConfiguration()
    .Destructure.ByIgnoringProperties<User>(u => u.Password)
    // Other logger configurationg
    .CreateLogger()

When these types are destructured, all properties except the specified ones will be passed through:

Log.Information("Logged on {@User}", new User { Username = "nick", Password = "This is ignored" });

// Prints `Logged on User { Username: "nick"  }`

About

Specify how complex types are logged to Serilog by excluding individual properties.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 89.3%
  • PowerShell 10.7%