I\'m using Serilog with an MS SQL Server sink in my application. Let\'s assume I have defined the following class ...
public class Person
{
public string First
If you're using the generic Microsoft ILogger interface you can use BeginScope;
using (_logger.BeginScope(new Dictionary { { "LogEventType", logEventType }, { "UserName", userName } }))
{
_logger.LogInformation(message, args);
}
This is discussed here; https://blog.rsuter.com/logging-with-ilogger-recommendations-and-best-practices/