From 3c358e90283d509c42d21434c0324e4f0cceee27 Mon Sep 17 00:00:00 2001 From: John Luo Date: Sat, 22 Apr 2017 22:17:28 -0700 Subject: [PATCH] Replace ConfigureLogging(Action) with ConfigureLogging(Action) extension --- .../IWebHostBuilder.cs | 7 ------- .../breakingchanges.netcore.json | 5 +++++ .../WebHostBuilder.cs | 16 ---------------- .../WebHostBuilderExtensions.cs | 11 +++++++++++ 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs index ae5dd39745..f380488cf5 100644 --- a/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs +++ b/src/Microsoft.AspNetCore.Hosting.Abstractions/IWebHostBuilder.cs @@ -29,13 +29,6 @@ namespace Microsoft.AspNetCore.Hosting /// IWebHostBuilder ConfigureAppConfiguration(Action configureDelegate); - /// - /// Adds a delegate for configuring the provided . This may be called multiple times. - /// - /// The delegate that configures the . - /// The . - IWebHostBuilder ConfigureLogging(Action configureLogging); - /// /// Adds a delegate for configuring the provided . This may be called multiple times. /// diff --git a/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json index 98f79f9f67..4df8dcfa04 100644 --- a/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json +++ b/src/Microsoft.AspNetCore.Hosting.Abstractions/breakingchanges.netcore.json @@ -33,5 +33,10 @@ "TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHost : System.IDisposable", "MemberId": "System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken)", "Kind": "Addition" + }, + { + "TypeId": "public interface Microsoft.AspNetCore.Hosting.IWebHostBuilder", + "MemberId": "Microsoft.AspNetCore.Hosting.IWebHostBuilder ConfigureLogging(System.Action configureLogging)", + "Kind": "Removal" } ] \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs index 368fdc9d7c..93f09b6c5b 100644 --- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs +++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs @@ -157,22 +157,6 @@ namespace Microsoft.AspNetCore.Hosting return this; } - /// - /// Adds a delegate for configuring the provided . This may be called multiple times. - /// - /// The delegate that configures the . - /// The . - public IWebHostBuilder ConfigureLogging(Action configureLogging) - { - if (configureLogging == null) - { - throw new ArgumentNullException(nameof(configureLogging)); - } - - _configureLoggingDelegates.Add((_, factory) => configureLogging(factory)); - return this; - } - /// /// Adds a delegate for configuring the provided . This may be called multiple times. /// diff --git a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs index fa857c897e..f425d59269 100644 --- a/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Hosting/WebHostBuilderExtensions.cs @@ -107,6 +107,17 @@ namespace Microsoft.AspNetCore.Hosting }); } + /// + /// Adds a delegate for configuring the provided . This may be called multiple times. + /// + /// The to configure. + /// The delegate that configures the . + /// The . + public static IWebHostBuilder ConfigureLogging(this IWebHostBuilder hostBuilder, Action configureLogging) + { + return hostBuilder.ConfigureLogging((_, loggerFactory) => configureLogging(loggerFactory)); + } + /// /// Adds a delegate for configuring the provided . This may be called multiple times. ///