I have a logger wrapper and I wanna inject serilog to it with following configurtion perse:
var logger = new LoggerConfiguration()
.WriteTo.RollingFile(
AppDomain.CurrentDomain.GetData("DataDirectory").ToString() + "/Log-{Date}.txt")
.CreateLogger();
I cant seem to find a correct way to register it. I want it as singleton. Above is the instance.
I tried registering the instance above. Didnt work. I tried lambda, didnt work.
What works? anyone?
Maybe this helps:
builder.Register<ILogger>((c, p) =>
{
return new LoggerConfiguration()
.WriteTo.RollingFile(
AppDomain.CurrentDomain.GetData("DataDirectory").ToString() + "/Log-{Date}.txt")
.CreateLogger();
}).SingleInstance();