So I'm trying to setup ILogger with Dependency Injection and I'm having some trouble.
In my startup.cs file I have something that looks like this:
builder.Services.AddLogging();
I then try to feed that logger to my own class (which acts like a wrapper around the ILogger library)
builder.Services.AddSingleton<LoggingWrapper>(s =>
{
return new LoggingWrapper(
s.GetService<ILoggerFactory>());
});
So in my Azure function, LoggingWrapper gets injected inside, but it doesn't log anything. The normal ILogger that comes with each function still works, but I'm wondering as to why my wrapper isn't logging anything.
Logging Wrapper is a class that takes the ILogger methods and uses it to create it's own logging methods. For example loggingWrapper.logInformation("string") is a method that would wrap around `ILogger.
I inject this into my other classes like this: s.GetService<ILoggerFactory>()
Thanks in advance for all the help!