Should frameworks like Serilog, NLog implement their own ILoggerFactory? #420
Description
cc @304NotModified @nblumhardt
Since it is now possible to pass a custom ILoggerFactory
into the WebHostBuilder
by calling IWebHostBuilder.UseLoggerFactory(ILoggerFactory loggerFactory)
, I'm wondering if it would make more sense for 3rd party frameworks like Serilog, NLog to implement their own ILoggerFactory
in addition to (or even instead of) a ILoggerProvider
?
To me, it seems like ILoggerProvider
is better for actual outputs like Console, EventLog, ... and ILoggerFactory
would be better for frameworks. It's not really useful to combine a provider from M.E.L
(e.g. Console) with sinks from Serilog because Serilog has a sink for each M.E.L-provider anyway. So, routing all logs through Microsoft.Extensions.Logging.dll
seems like an unnecessary step.
If all logging frameworks would implement ILoggerFactory
, we could also think about removing the assembly Microsoft.Extensions.Logging.dll
from aspnet/hosting
! The choice of a logging framework is the same as the choice of a server (e.g. Kestrel) IMO. This means, Microsoft.Extensions.Logging
(which is just Microsoft's implementation) could be part of the template, but if someone wants to use Serilog/NLog he would remove the dependency and therefore wouldn't have Microsoft.Extensions.Logging.dll on disk anymore.