Is there anyway to enrich all Serilog output with the Method Name.
For Instance consider If I have the following;
Public Class MyClassName
Privat
The version on C# could be simplified. Just use AutofacSerilogIntegration:
var path = Server.MapPath("~/");
var outputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} {Message} {NewLine}{Exception}";
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.File($"{path}/log/serilog-.log", LogEventLevel.Debug, outputTemplate, rollingInterval: RollingInterval.Day)
.CreateLogger();
var builder = new ContainerBuilder();
builder.RegisterLogger(); // from AutofacSerilogIntegration
builder.RegisterControllers(typeof(MvcApplication).Assembly);
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));