React to Logging API changes (#33)

This commit is contained in:
BrennanConroy 2017-05-02 15:35:53 -07:00 committed by GitHub
parent fe455f33ab
commit e96e2872f5
5 changed files with 17 additions and 12 deletions

View File

@ -24,12 +24,10 @@ namespace IISSample
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
{
loggerFactory.AddConsole(LogLevel.Debug);
var logger = loggerFactory.CreateLogger("Requests");
app.UseMvcWithDefaultRoute();
app.Map("/log", logApp => logApp.Run((context) =>
app.Map("/log", logApp => logApp.Run(context =>
{
TelemetryConfiguration.Active.TelemetryChannel = new CurrentResponseTelemetryChannel(context.Response);
@ -55,7 +53,7 @@ namespace IISSample
TelemetryConfiguration.Active.TelemetryChannel = null;
return Task.FromResult(true);
return Task.CompletedTask;
}));
app.Run(async (context) =>
{
@ -110,6 +108,11 @@ namespace IISSample
.Build();
var host = new WebHostBuilder()
.ConfigureLogging((hostingContext, factory) =>
{
factory.UseConfiguration(hostingContext.Configuration.GetSection("Logging"))
.AddConsole();
})
.UseKestrel()
.UseStartup<Startup>()
.UseContentRoot(Directory.GetCurrentDirectory())

View File

@ -16,8 +16,6 @@ namespace IISSample
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
{
loggerfactory.AddConsole(LogLevel.Debug);
var logger = loggerfactory.CreateLogger("Requests");
app.Run(async (context) =>
@ -68,6 +66,10 @@ namespace IISSample
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.ConfigureLogging(factory =>
{
factory.AddConsole();
})
.UseKestrel()
.UseStartup<Startup>()
.Build();

View File

@ -23,8 +23,6 @@ namespace IISSample
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
{
loggerfactory.AddConsole(LogLevel.Debug);
var logger = loggerfactory.CreateLogger("Requests");
app.Run(async (context) =>
@ -75,6 +73,10 @@ namespace IISSample
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.ConfigureLogging(factory =>
{
factory.AddConsole();
})
.UseKestrel()
.UseAzureAppServices()
.UseStartup<Startup>()

View File

@ -6,8 +6,6 @@ using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;
using Xunit.Abstractions;
@ -19,7 +17,7 @@ namespace ApplicationInsightsJavaScriptSnippetTest
{
}
[ConditionalTheory(Skip = "https://github.com/aspnet/AzureIntegration/issues/41")]
[Theory]
[InlineData(ApplicationType.Portable)]
[InlineData(ApplicationType.Standalone)]
public async Task ScriptInjected(ApplicationType applicationType)

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests
mock.Object.UseAzureAppServices();
mock.Verify(builder => builder.ConfigureLogging(It.IsNotNull<Action<ILoggerFactory>>()), Times.Once);
mock.Verify(builder => builder.ConfigureLogging(It.IsNotNull<Action<LoggerFactory>>()), Times.Once);
}
}
}