Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Add WebHostBuilderContext to ConfigureLogging<T> and remove UseLoggerFactory(this IWebHostBuilder hostBuilder, Action<WebHostBuilderContext, LoggerFactory> configure) #1015

Closed
JunTaoLuo opened this issue Apr 10, 2017 · 2 comments

Comments

@JunTaoLuo
Copy link
Contributor

ConfigureLogging(Action configureLogging) is missing the WebHostBuilderContext and cannot handle logging configuration that may be dependent on configuration for example.

Remove the overload of UseLoggerFactory since it provides little additional benefit compared to just using UseLoggerFactory(Func<WebHostBuilderContext, ILoggerFactory> createLoggerFactory)

cc @glennc

@glennc
Copy link
Member

glennc commented Apr 10, 2017

Also ConfigureLogging<LoggerFactory>(Action<LoggerFactory> configureLogging) and ConfigureLogging<LoggerFactory>(Action<Context, LoggerFactory> configureLogging) extension method, fill in the T. That way code like this works:

builder.ConfigureLogging(loggerFactory => loggerFactory.AddConsole());
builder.ConfigureLogging((context, factory) => factory.AddFileLogger(context.Configuration["LogFileName"]));

Right?

@JunTaoLuo
Copy link
Contributor Author

Thanks @glennc for the pr #1020

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants