React to Logging API changes (#33)
This commit is contained in:
parent
fe455f33ab
commit
e96e2872f5
|
|
@ -24,12 +24,10 @@ namespace IISSample
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
loggerFactory.AddConsole(LogLevel.Debug);
|
|
||||||
|
|
||||||
var logger = loggerFactory.CreateLogger("Requests");
|
var logger = loggerFactory.CreateLogger("Requests");
|
||||||
|
|
||||||
app.UseMvcWithDefaultRoute();
|
app.UseMvcWithDefaultRoute();
|
||||||
app.Map("/log", logApp => logApp.Run((context) =>
|
app.Map("/log", logApp => logApp.Run(context =>
|
||||||
{
|
{
|
||||||
TelemetryConfiguration.Active.TelemetryChannel = new CurrentResponseTelemetryChannel(context.Response);
|
TelemetryConfiguration.Active.TelemetryChannel = new CurrentResponseTelemetryChannel(context.Response);
|
||||||
|
|
||||||
|
|
@ -55,7 +53,7 @@ namespace IISSample
|
||||||
|
|
||||||
TelemetryConfiguration.Active.TelemetryChannel = null;
|
TelemetryConfiguration.Active.TelemetryChannel = null;
|
||||||
|
|
||||||
return Task.FromResult(true);
|
return Task.CompletedTask;
|
||||||
}));
|
}));
|
||||||
app.Run(async (context) =>
|
app.Run(async (context) =>
|
||||||
{
|
{
|
||||||
|
|
@ -110,6 +108,11 @@ namespace IISSample
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging((hostingContext, factory) =>
|
||||||
|
{
|
||||||
|
factory.UseConfiguration(hostingContext.Configuration.GetSection("Logging"))
|
||||||
|
.AddConsole();
|
||||||
|
})
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ namespace IISSample
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
{
|
{
|
||||||
loggerfactory.AddConsole(LogLevel.Debug);
|
|
||||||
|
|
||||||
var logger = loggerfactory.CreateLogger("Requests");
|
var logger = loggerfactory.CreateLogger("Requests");
|
||||||
|
|
||||||
app.Run(async (context) =>
|
app.Run(async (context) =>
|
||||||
|
|
@ -68,6 +66,10 @@ namespace IISSample
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ namespace IISSample
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
{
|
{
|
||||||
loggerfactory.AddConsole(LogLevel.Debug);
|
|
||||||
|
|
||||||
var logger = loggerfactory.CreateLogger("Requests");
|
var logger = loggerfactory.CreateLogger("Requests");
|
||||||
|
|
||||||
app.Run(async (context) =>
|
app.Run(async (context) =>
|
||||||
|
|
@ -75,6 +73,10 @@ namespace IISSample
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
.UseAzureAppServices()
|
.UseAzureAppServices()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@ using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
|
@ -19,7 +17,7 @@ namespace ApplicationInsightsJavaScriptSnippetTest
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory(Skip = "https://github.com/aspnet/AzureIntegration/issues/41")]
|
[Theory]
|
||||||
[InlineData(ApplicationType.Portable)]
|
[InlineData(ApplicationType.Portable)]
|
||||||
[InlineData(ApplicationType.Standalone)]
|
[InlineData(ApplicationType.Standalone)]
|
||||||
public async Task ScriptInjected(ApplicationType applicationType)
|
public async Task ScriptInjected(ApplicationType applicationType)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests
|
||||||
|
|
||||||
mock.Object.UseAzureAppServices();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue