Last active
November 3, 2015 22:25
-
-
Save dimitrispaxinos/4eaf3e0562bc3d731d9e to your computer and use it in GitHub Desktop.
Serilog: Log with basic context property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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