-
Notifications
You must be signed in to change notification settings - Fork 311
Replace ConfigureLogging(Action<ILoggerFactory>) with ConfigureLogging(Action<LoggerFactory>) #1035
Replace ConfigureLogging(Action<ILoggerFactory>) with ConfigureLogging(Action<LoggerFactory>) #1035
Conversation
/// </summary> | ||
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to be used.</param> | ||
/// <returns>The <see cref="IWebHostBuilder"/>.</returns> | ||
[Obsolete("This method is obsolete and will be removed in a future version. The recommended alternative is Microsoft.AspNetCore.Hosting.IwebHostBuilder.UseLoggerFactory(Func<WebHostBuilderContext, ILoggerFactory> createLoggerFactory).")] | ||
IWebHostBuilder UseLoggerFactory(ILoggerFactory loggerFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need to deprecate this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you are right. @glennc when I originally filed the issue I remember we said we wanted to deprecate both but I don't see why we want to force anyone to use the overload with the context if it's not needed. Can you confirm whether we want to deprecate this?
/// </summary> | ||
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to be used.</param> | ||
/// <returns>The <see cref="IWebHostBuilder"/>.</returns> | ||
[Obsolete("This method is obsolete and will be removed in a future version. The recommended alternative is Microsoft.AspNetCore.Hosting.IwebHostBuilder.UseLoggerFactory(Func<WebHostBuilderContext, ILoggerFactory> createLoggerFactory).")] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:spacing
cd77f39
to
b5e30f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright to me. I'm curious that no tests needed a #pragma
to disable the obsolete warning. Are there no tests that call these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should do this. Instead we should:
- Remove this overload completely instead of deprecating it. It'll only break older libraries that targeted this interface which is mostly nobody.
- Add an extension method
ConfigureLogging(Action<LoggerFactory>)
to replace this. It's source compatible with the old overload and upgrading applications will just work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should do this. Instead we should:
- Remove this overload completely instead of deprecating it. It'll only break older libraries that targeted this interface which is mostly nobody.
- Add an extension method
ConfigureLogging(Action<LoggerFactory>)
to replace this. It's source compatible with the old overload and upgrading applications will just work.
@davidfowl the issue has be triaged to preview2. Do you think that is okay or should we pull it back to preview1? |
b5e30f9
to
2677d21
Compare
0b53ff1
to
09d58a6
Compare
ping @muratg @davidfowl @BrennanConroy @Tratcher since we want to pull this change back to preview1. |
@@ -20,6 +20,7 @@ | |||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(AspNetCoreVersion)" /> | |||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(AspNetCoreVersion)" /> | |||
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="$(AspNetCoreVersion)" /> | |||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops this needs to be moved to extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a no-go isn't it?!
f4dc329
to
c871a73
Compare
…g(Action<LoggerFactory>) extension
c871a73
to
3c358e9
Compare
addresses #1007