In my custom logger I used to track the calling method and now that I’m using serilog I’m not sure how to achieve the same result. I’ve added the Serilog.Enrichers.CallerInfo Nuget package and I’m creating the serilog logger as follows
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.Enrich.WithCallerInfo(true, "<assemblyname>")
.Enrich.WithExceptionDetails()
.WriteTo.File("logs/serilog2-logfile.txt", outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{Caller}] {Message}")
.CreateLogger();
but I’m not seeing anything being logged for the caller. What am I missing?