diff --git a/eng/Build.props b/eng/Build.props index c28b3bc1e9..ef89408b47 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -152,7 +152,7 @@ $(RepoRoot)src\SiteExtensions\LoggingAggregate\test\**\*.csproj; $(RepoRoot)src\Shared\**\*.*proj; $(RepoRoot)src\Tools\**\*.*proj; - $(RepoRoot)src\Logging\**\src\*.csproj; + $(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj; $(RepoRoot)src\Middleware\**\*.csproj; $(RepoRoot)src\Razor\**\*.*proj; $(RepoRoot)src\Mvc\**\*.*proj; @@ -192,7 +192,7 @@ $(RepoRoot)src\Security\**\src\*.csproj; $(RepoRoot)src\SiteExtensions\**\src\*.csproj; $(RepoRoot)src\Tools\**\src\*.csproj; - $(RepoRoot)src\Logging\**\src\*.csproj; + $(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj; $(RepoRoot)src\Middleware\**\src\*.csproj; $(RepoRoot)src\Razor\**\src\*.csproj; $(RepoRoot)src\Mvc\**\src\*.csproj; diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 3f63f1a68a..a7d42c3782 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -32,8 +32,7 @@ - - + diff --git a/src/Components/test/testassets/TestServer/Components.TestServer.csproj b/src/Components/test/testassets/TestServer/Components.TestServer.csproj index 4eebc1f24b..d51a812210 100644 --- a/src/Components/test/testassets/TestServer/Components.TestServer.csproj +++ b/src/Components/test/testassets/TestServer/Components.TestServer.csproj @@ -14,8 +14,8 @@ + - diff --git a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj index ba625f4332..939dfcf376 100644 --- a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj +++ b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj @@ -23,7 +23,6 @@ - diff --git a/src/Logging/Logging.AzureAppServices/Directory.Build.props b/src/Logging.AzureAppServices/Directory.Build.props similarity index 100% rename from src/Logging/Logging.AzureAppServices/Directory.Build.props rename to src/Logging.AzureAppServices/Directory.Build.props diff --git a/src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs b/src/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs rename to src/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs b/src/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs rename to src/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs b/src/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs rename to src/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs b/src/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs rename to src/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs b/src/Logging.AzureAppServices/src/BatchingLogger.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs rename to src/Logging.AzureAppServices/src/BatchingLogger.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs b/src/Logging.AzureAppServices/src/BatchingLoggerOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs rename to src/Logging.AzureAppServices/src/BatchingLoggerOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs b/src/Logging.AzureAppServices/src/BatchingLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs rename to src/Logging.AzureAppServices/src/BatchingLoggerProvider.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs b/src/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs rename to src/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs b/src/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs rename to src/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs b/src/Logging.AzureAppServices/src/BlobLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs rename to src/Logging.AzureAppServices/src/BlobLoggerProvider.cs diff --git a/src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs b/src/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs rename to src/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs diff --git a/src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs b/src/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs rename to src/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs diff --git a/src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs b/src/Logging.AzureAppServices/src/FileLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs rename to src/Logging.AzureAppServices/src/FileLoggerProvider.cs diff --git a/src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs b/src/Logging.AzureAppServices/src/ICloudAppendBlob.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs rename to src/Logging.AzureAppServices/src/ICloudAppendBlob.cs diff --git a/src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs b/src/Logging.AzureAppServices/src/IWebAppContext.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs rename to src/Logging.AzureAppServices/src/IWebAppContext.cs diff --git a/src/Logging/Logging.AzureAppServices/src/LogMessage.cs b/src/Logging.AzureAppServices/src/LogMessage.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/LogMessage.cs rename to src/Logging.AzureAppServices/src/LogMessage.cs diff --git a/src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj b/src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj rename to src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj diff --git a/src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs b/src/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs rename to src/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs diff --git a/src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs b/src/Logging.AzureAppServices/src/SiteConfigurationProvider.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs rename to src/Logging.AzureAppServices/src/SiteConfigurationProvider.cs diff --git a/src/Logging/Logging.AzureAppServices/src/WebAppContext.cs b/src/Logging.AzureAppServices/src/WebAppContext.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/src/WebAppContext.cs rename to src/Logging.AzureAppServices/src/WebAppContext.cs diff --git a/src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs b/src/Logging.AzureAppServices/test/AzureAppendBlobTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs rename to src/Logging.AzureAppServices/test/AzureAppendBlobTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs b/src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs rename to src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs b/src/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs rename to src/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs b/src/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs rename to src/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs b/src/Logging.AzureAppServices/test/ConfigureOptionsTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs rename to src/Logging.AzureAppServices/test/ConfigureOptionsTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs b/src/Logging.AzureAppServices/test/FileLoggerTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs rename to src/Logging.AzureAppServices/test/FileLoggerTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs b/src/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs rename to src/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs diff --git a/src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs b/src/Logging.AzureAppServices/test/ManualIntervalControl.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs rename to src/Logging.AzureAppServices/test/ManualIntervalControl.cs diff --git a/src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj b/src/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj rename to src/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj diff --git a/src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs b/src/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs rename to src/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs diff --git a/src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs b/src/Logging.AzureAppServices/test/TestBlobSink.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs rename to src/Logging.AzureAppServices/test/TestBlobSink.cs diff --git a/src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs b/src/Logging.AzureAppServices/test/TestFileLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs rename to src/Logging.AzureAppServices/test/TestFileLoggerProvider.cs diff --git a/src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs b/src/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs similarity index 100% rename from src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs rename to src/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs diff --git a/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj b/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj deleted file mode 100644 index eabb677844..0000000000 --- a/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - Helpers for writing tests that use Microsoft.Extensions.Logging. Contains null implementations of the abstractions that do nothing, as well as test implementations that are observable. - netstandard2.0;net472 - $(NoWarn);CS1591 - $(PackageTags);testing - - false - false - true - - - - - - - - - - - - - - - - - - diff --git a/src/Logging/Logging.Testing/test/Microsoft.Extensions.Logging.Testing.Tests.csproj b/src/Logging/Logging.Testing/test/Microsoft.Extensions.Logging.Testing.Tests.csproj deleted file mode 100644 index 4ec80710b7..0000000000 --- a/src/Logging/Logging.Testing/test/Microsoft.Extensions.Logging.Testing.Tests.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - $(DefaultNetCoreTargetFramework);net472 - - - - - - - - - - - - diff --git a/src/Logging/Logging.Testing/test/Properties/AssemblyInfo.cs b/src/Logging/Logging.Testing/test/Properties/AssemblyInfo.cs deleted file mode 100644 index 9ae4865e3a..0000000000 --- a/src/Logging/Logging.Testing/test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Testing; - -[assembly: LogLevel(LogLevel.Trace)] diff --git a/src/Logging/Logging.Testing/test/TestTestOutputHelper.cs b/src/Logging/Logging.Testing/test/TestTestOutputHelper.cs deleted file mode 100644 index 5a5f6aa85f..0000000000 --- a/src/Logging/Logging.Testing/test/TestTestOutputHelper.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using Xunit.Abstractions; - -namespace Microsoft.Extensions.Logging.Testing.Tests -{ - public class TestTestOutputHelper : ITestOutputHelper - { - private StringBuilder _output = new StringBuilder(); - - public bool Throw { get; set; } - - public string Output => _output.ToString(); - - public void WriteLine(string message) - { - if (Throw) - { - throw new Exception("Boom!"); - } - _output.AppendLine(message); - } - - public void WriteLine(string format, params object[] args) - { - if (Throw) - { - throw new Exception("Boom!"); - } - _output.AppendLine(string.Format(format, args)); - } - } -} diff --git a/src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj b/src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj index ced51607d8..e4ff5df0cc 100644 --- a/src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj +++ b/src/Servers/IIS/IIS/test/testassets/IIS.Common.TestLib/IIS.Common.TestLib.csproj @@ -7,8 +7,8 @@ + - diff --git a/src/Servers/Kestrel/Directory.Build.props b/src/Servers/Kestrel/Directory.Build.props index 05b71894da..1b0e999039 100644 --- a/src/Servers/Kestrel/Directory.Build.props +++ b/src/Servers/Kestrel/Directory.Build.props @@ -20,7 +20,5 @@ - - diff --git a/src/SignalR/Directory.Build.props b/src/SignalR/Directory.Build.props index 27a3751cd8..74b4c7adee 100644 --- a/src/SignalR/Directory.Build.props +++ b/src/SignalR/Directory.Build.props @@ -21,7 +21,6 @@ PreserveNewest - diff --git a/src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj b/src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj index 9e69675720..782c8410b8 100644 --- a/src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj +++ b/src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj @@ -21,7 +21,6 @@ - diff --git a/src/Logging/Logging.Testing/src/BeginScopeContext.cs b/src/Testing/src/Logging/BeginScopeContext.cs similarity index 100% rename from src/Logging/Logging.Testing/src/BeginScopeContext.cs rename to src/Testing/src/Logging/BeginScopeContext.cs diff --git a/src/Logging/Logging.Testing/src/ITestSink.cs b/src/Testing/src/Logging/ITestSink.cs similarity index 100% rename from src/Logging/Logging.Testing/src/ITestSink.cs rename to src/Testing/src/Logging/ITestSink.cs diff --git a/src/Logging/Logging.Testing/src/LogLevelAttribute.cs b/src/Testing/src/Logging/LogLevelAttribute.cs similarity index 100% rename from src/Logging/Logging.Testing/src/LogLevelAttribute.cs rename to src/Testing/src/Logging/LogLevelAttribute.cs diff --git a/src/Logging/Logging.Testing/src/LogValuesAssert.cs b/src/Testing/src/Logging/LogValuesAssert.cs similarity index 100% rename from src/Logging/Logging.Testing/src/LogValuesAssert.cs rename to src/Testing/src/Logging/LogValuesAssert.cs diff --git a/src/Logging/Logging.Testing/src/TestLogger.cs b/src/Testing/src/Logging/TestLogger.cs similarity index 100% rename from src/Logging/Logging.Testing/src/TestLogger.cs rename to src/Testing/src/Logging/TestLogger.cs diff --git a/src/Logging/Logging.Testing/src/TestLoggerFactory.cs b/src/Testing/src/Logging/TestLoggerFactory.cs similarity index 100% rename from src/Logging/Logging.Testing/src/TestLoggerFactory.cs rename to src/Testing/src/Logging/TestLoggerFactory.cs diff --git a/src/Logging/Logging.Testing/src/TestLoggerProvider.cs b/src/Testing/src/Logging/TestLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.Testing/src/TestLoggerProvider.cs rename to src/Testing/src/Logging/TestLoggerProvider.cs diff --git a/src/Logging/Logging.Testing/src/TestLoggerT.cs b/src/Testing/src/Logging/TestLoggerT.cs similarity index 100% rename from src/Logging/Logging.Testing/src/TestLoggerT.cs rename to src/Testing/src/Logging/TestLoggerT.cs diff --git a/src/Logging/Logging.Testing/src/TestSink.cs b/src/Testing/src/Logging/TestSink.cs similarity index 100% rename from src/Logging/Logging.Testing/src/TestSink.cs rename to src/Testing/src/Logging/TestSink.cs diff --git a/src/Logging/Logging.Testing/src/WriteContext.cs b/src/Testing/src/Logging/WriteContext.cs similarity index 100% rename from src/Logging/Logging.Testing/src/WriteContext.cs rename to src/Testing/src/Logging/WriteContext.cs diff --git a/src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs b/src/Testing/src/Logging/XunitLoggerFactoryExtensions.cs similarity index 100% rename from src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs rename to src/Testing/src/Logging/XunitLoggerFactoryExtensions.cs diff --git a/src/Logging/Logging.Testing/src/XunitLoggerProvider.cs b/src/Testing/src/Logging/XunitLoggerProvider.cs similarity index 100% rename from src/Logging/Logging.Testing/src/XunitLoggerProvider.cs rename to src/Testing/src/Logging/XunitLoggerProvider.cs diff --git a/src/Testing/src/Microsoft.AspNetCore.Testing.csproj b/src/Testing/src/Microsoft.AspNetCore.Testing.csproj index 5ddad7b645..7d95e026a7 100644 --- a/src/Testing/src/Microsoft.AspNetCore.Testing.csproj +++ b/src/Testing/src/Microsoft.AspNetCore.Testing.csproj @@ -19,7 +19,9 @@ - + + + diff --git a/src/Logging/Logging.Testing/test/LogValuesAssertTest.cs b/src/Testing/test/LogValuesAssertTest.cs similarity index 100% rename from src/Logging/Logging.Testing/test/LogValuesAssertTest.cs rename to src/Testing/test/LogValuesAssertTest.cs diff --git a/src/Logging/Logging.Testing/test/XunitLoggerProviderTest.cs b/src/Testing/test/XunitLoggerProviderTest.cs similarity index 85% rename from src/Logging/Logging.Testing/test/XunitLoggerProviderTest.cs rename to src/Testing/test/XunitLoggerProviderTest.cs index 8a3fbbab25..e43447c465 100644 --- a/src/Logging/Logging.Testing/test/XunitLoggerProviderTest.cs +++ b/src/Testing/test/XunitLoggerProviderTest.cs @@ -4,7 +4,7 @@ using System; using System.Text.RegularExpressions; -using Microsoft.Extensions.Logging.Test; +using Microsoft.Extensions.DependencyInjection; using Xunit; namespace Microsoft.Extensions.Logging.Testing.Tests @@ -16,7 +16,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = TestLoggerBuilder.Create(builder => builder + var loggerFactory = CreateTestLogger(builder => builder .SetMinimumLevel(LogLevel.Trace) .AddXunit(testTestOutputHelper)); @@ -35,7 +35,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests public void LoggerProviderDoesNotWriteLogMessagesBelowMinimumLevel() { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = TestLoggerBuilder.Create(builder => builder + var loggerFactory = CreateTestLogger(builder => builder .AddXunit(testTestOutputHelper, LogLevel.Warning)); var logger = loggerFactory.CreateLogger("TestCategory"); @@ -49,7 +49,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests public void LoggerProviderPrependsPrefixToEachLine() { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = TestLoggerBuilder.Create(builder => builder + var loggerFactory = CreateTestLogger(builder => builder .AddXunit(testTestOutputHelper)); var logger = loggerFactory.CreateLogger("TestCategory"); @@ -68,7 +68,7 @@ namespace Microsoft.Extensions.Logging.Testing.Tests public void LoggerProviderDoesNotThrowIfOutputHelperThrows() { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = TestLoggerBuilder.Create(builder => builder + var loggerFactory = CreateTestLogger(builder => builder .AddXunit(testTestOutputHelper)); @@ -83,5 +83,13 @@ namespace Microsoft.Extensions.Logging.Testing.Tests private static readonly Regex TimestampRegex = new Regex(@"\d+-\d+-\d+T\d+:\d+:\d+"); private string MakeConsistent(string input) => TimestampRegex.Replace(input, "TIMESTAMP"); + + private static ILoggerFactory CreateTestLogger(Action configure) + { + return new ServiceCollection() + .AddLogging(configure) + .BuildServiceProvider() + .GetRequiredService(); + } } }