Skip to content

Instantly share code, notes, and snippets.

@dimitrispaxinos
Created November 3, 2015 18:37
Show Gist options
  • Save dimitrispaxinos/3f8b01cc087eae37063f to your computer and use it in GitHub Desktop.
Save dimitrispaxinos/3f8b01cc087eae37063f to your computer and use it in GitHub Desktop.
Serilog: Include class name in the context
// Explicitly including the class
Log.Logger.ForContext<MainWindow>().Information("This log entry includes the class name as context");
// More generic getting the type of the class we are in
Log.Logger.ForContext(this.GetType()).Information("This log entry includes the class name as context");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment