public static IServiceCollection AddLogging(this IServiceCollection services, Action<ILoggingBuilder> configure);
in the Microsoft.Extensions.Logging assembly will not work as expected. The translator will detect multiple ILoggingProviders and throw an exception. If only one is provided, it will not be injected properly and [Inject] will provide a Logger implementation that appears to do nothing.
I got around this by manually doing what the extension method does,
ILoggerFactory loggerFactory = LoggerFactory.Create(b => ...);
services.AddSingleton(loggerFactory)
services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));
Sorry if this is a terribly uninformed post. It took me a while to get logging working and I'm hoping this will be useful information to someone at some point.
Thanks for making this Kurai.
public static IServiceCollection AddLogging(this IServiceCollection services, Action<ILoggingBuilder> configure);in the Microsoft.Extensions.Logging assembly will not work as expected. The translator will detect multiple ILoggingProviders and throw an exception. If only one is provided, it will not be injected properly and [Inject] will provide a Logger implementation that appears to do nothing.
I got around this by manually doing what the extension method does,
ILoggerFactory loggerFactory = LoggerFactory.Create(b => ...);services.AddSingleton(loggerFactory)services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));Sorry if this is a terribly uninformed post. It took me a while to get logging working and I'm hoping this will be useful information to someone at some point.
Thanks for making this Kurai.