Closed jorenp closed 4 years ago
When you're using MIcrosoft DI, you can AddRebus
with the overload that passes IServiceProvider
in, and then you should be able to do something like this:
services.AddRebus((configure, provider) =>
configure.Transport(...)
.Logging(l => l.MicrosoftExtensionsLogging(provider.GetRequiredService<ILoggerFactory>()))
.(...)
);
Isn't this what you need?
Completely missed that overload, sorry. That solves it indeed. Thanks, I'll close this issue.
Perfect! 🙂
I was looking at integrating Rebus with App Insights. But I'm struggling a bit with the ILoggerFactory reference. We don't add the LoggerFactory directly to the container at the moment. So we don't have a reference when configuring the container. Adding support for passing in a resolver function would allow us to use the DI container.![image](https://user-images.githubusercontent.com/11046831/78214693-20b7ae80-74b6-11ea-861c-13beed48df6d.png)
Or is this a daft idea and should I just manually create a LoggerFactory instance?