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

Replace ConfigureLogging(Action<ILoggerFactory>) with ConfigureLogging(Action<LoggerFactory>) #1035

Merged
merged 1 commit into from
May 2, 2017

Conversation

JunTaoLuo
Copy link
Contributor

@JunTaoLuo JunTaoLuo commented Apr 23, 2017

addresses #1007

/// </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);
Copy link
Member

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.

Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Apr 23, 2017

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).")]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:spacing

@JunTaoLuo JunTaoLuo force-pushed the johluo/obsolete-configure-logging branch 2 times, most recently from cd77f39 to b5e30f9 Compare April 24, 2017 18:47
Copy link
Member

@Eilon Eilon left a 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?

davidfowl
davidfowl previously approved these changes Apr 27, 2017
Copy link
Member

@davidfowl davidfowl left a 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.

Copy link
Member

@davidfowl davidfowl left a 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.

@JunTaoLuo
Copy link
Contributor Author

@davidfowl the issue has be triaged to preview2. Do you think that is okay or should we pull it back to preview1?

@JunTaoLuo JunTaoLuo force-pushed the johluo/obsolete-configure-logging branch from b5e30f9 to 2677d21 Compare May 2, 2017 18:23
@JunTaoLuo JunTaoLuo changed the base branch from dev to rel/2.0.0-preview1 May 2, 2017 18:40
@JunTaoLuo JunTaoLuo force-pushed the johluo/obsolete-configure-logging branch from 0b53ff1 to 09d58a6 Compare May 2, 2017 18:45
@JunTaoLuo JunTaoLuo requested a review from BrennanConroy May 2, 2017 18:48
@JunTaoLuo
Copy link
Contributor Author

ping @muratg @davidfowl @BrennanConroy @Tratcher since we want to pull this change back to preview1.

@JunTaoLuo JunTaoLuo changed the title Mark ConfigureLogging and UseLoggerFactory overloads with ILoggerFact… Replace ConfigureLogging(Action<ILoggerFactory>) with ConfigureLogging(Action<LoggerFactory>) May 2, 2017
@@ -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)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm

Copy link
Contributor Author

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.

Copy link
Contributor

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?!

@JunTaoLuo JunTaoLuo force-pushed the johluo/obsolete-configure-logging branch from f4dc329 to c871a73 Compare May 2, 2017 19:49
@JunTaoLuo JunTaoLuo force-pushed the johluo/obsolete-configure-logging branch from c871a73 to 3c358e9 Compare May 2, 2017 20:01
@JunTaoLuo JunTaoLuo merged commit 3c358e9 into rel/2.0.0-preview1 May 2, 2017
@JunTaoLuo JunTaoLuo deleted the johluo/obsolete-configure-logging branch May 2, 2017 20:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants