Skip to content

Instantly share code, notes, and snippets.

@dimitrispaxinos
Last active April 7, 2017 18:57
Show Gist options
  • Save dimitrispaxinos/f466855297c2372d0400 to your computer and use it in GitHub Desktop.
Save dimitrispaxinos/f466855297c2372d0400 to your computer and use it in GitHub Desktop.
Serilog: Log with dynamic Object
var dynamicObject = new
{
OperatingSystem = "Windows",
Username = "TestUser",
OneMoreRandomProperty = "Random Property Value "
};
using (LogContext.PushProperty("DynamicObject", dynamicObject, destructureObjects: true))
{
Log.Logger.Information("This log entry includes a dynamic object");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment