Skip to content

Instantly share code, notes, and snippets.

@dimitrispaxinos
Last active November 3, 2015 22:25
Show Gist options
  • Save dimitrispaxinos/4eaf3e0562bc3d731d9e to your computer and use it in GitHub Desktop.
Save dimitrispaxinos/4eaf3e0562bc3d731d9e to your computer and use it in GitHub Desktop.
Serilog: Log with basic context property
// Add log event with a contextual property
using (LogContext.PushProperty("User", "Test User"))
{
Log.Logger.Information("This log entry includes a contextual property");
}
// Add log event without contextual properties
Log.Logger.Information("This log entry does not include any contextual property");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment