From 160d822f525f3f14cd55ff53bd9dac503947cf79 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 13 Nov 2018 09:48:28 -0800 Subject: [PATCH] Do not fallback to creating console logger (#1789) --- build/dependencies.props | 1 + samples/misc/LatencyTest/LatencyTest.csproj | 1 + .../misc/NodeServicesExamples/NodeServicesExamples.csproj | 1 + samples/misc/Webpack/Webpack.csproj | 1 + .../Configuration/NodeServicesOptions.cs | 6 ++---- .../Microsoft.AspNetCore.NodeServices.csproj | 2 +- .../Util/LoggerFinder.cs | 8 +++----- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 3094adc..7093dc0 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -16,6 +16,7 @@ 3.0.0-alpha1-10670 3.0.0-alpha1-10670 3.0.0-alpha1-10670 + 3.0.0-alpha1-10670 3.0.0-alpha1-10670 3.0.0-alpha1-10670 2.0.9 diff --git a/samples/misc/LatencyTest/LatencyTest.csproj b/samples/misc/LatencyTest/LatencyTest.csproj index 819f90e..596cecb 100644 --- a/samples/misc/LatencyTest/LatencyTest.csproj +++ b/samples/misc/LatencyTest/LatencyTest.csproj @@ -13,6 +13,7 @@ + diff --git a/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj b/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj index 90c4ad8..0bf244e 100644 --- a/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj +++ b/samples/misc/NodeServicesExamples/NodeServicesExamples.csproj @@ -18,6 +18,7 @@ + diff --git a/samples/misc/Webpack/Webpack.csproj b/samples/misc/Webpack/Webpack.csproj index 90c4ad8..0bf244e 100644 --- a/samples/misc/Webpack/Webpack.csproj +++ b/samples/misc/Webpack/Webpack.csproj @@ -18,6 +18,7 @@ + diff --git a/src/Microsoft.AspNetCore.NodeServices/Configuration/NodeServicesOptions.cs b/src/Microsoft.AspNetCore.NodeServices/Configuration/NodeServicesOptions.cs index 5b382ed..6a72b00 100644 --- a/src/Microsoft.AspNetCore.NodeServices/Configuration/NodeServicesOptions.cs +++ b/src/Microsoft.AspNetCore.NodeServices/Configuration/NodeServicesOptions.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.NodeServices.HostingModels; using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Logging.Console; +using Microsoft.Extensions.Logging.Abstractions; namespace Microsoft.AspNetCore.NodeServices { @@ -58,9 +58,7 @@ namespace Microsoft.AspNetCore.NodeServices var loggerFactory = serviceProvider.GetService(); NodeInstanceOutputLogger = loggerFactory != null ? loggerFactory.CreateLogger(LogCategoryName) -#pragma warning disable CS0618 // Type or member is obsolete - : new ConsoleLogger(LogCategoryName, null, false); -#pragma warning restore CS0618 + : NullLogger.Instance; // By default, we use this package's built-in out-of-process-via-HTTP hosting/transport this.UseHttpHosting(); } diff --git a/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj b/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj index 6d64797..2f46dee 100644 --- a/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj +++ b/src/Microsoft.AspNetCore.NodeServices/Microsoft.AspNetCore.NodeServices.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Microsoft.AspNetCore.SpaServices.Extensions/Util/LoggerFinder.cs b/src/Microsoft.AspNetCore.SpaServices.Extensions/Util/LoggerFinder.cs index e3a735f..d49b60c 100644 --- a/src/Microsoft.AspNetCore.SpaServices.Extensions/Util/LoggerFinder.cs +++ b/src/Microsoft.AspNetCore.SpaServices.Extensions/Util/LoggerFinder.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Console; +using Microsoft.Extensions.Logging.Abstractions; namespace Microsoft.AspNetCore.SpaServices.Util { @@ -14,13 +14,11 @@ namespace Microsoft.AspNetCore.SpaServices.Util IApplicationBuilder appBuilder, string logCategoryName) { - // If the DI system gives us a logger, use it. Otherwise, set up a default one. + // If the DI system gives us a logger, use it. Otherwise, set up a default one var loggerFactory = appBuilder.ApplicationServices.GetService(); var logger = loggerFactory != null ? loggerFactory.CreateLogger(logCategoryName) -#pragma warning disable CS0618 // Type or member is obsolete - : new ConsoleLogger(logCategoryName, null, false); -#pragma warning restore CS0618 + : NullLogger.Instance; return logger; } }