Increase logging in TS functional tests (#19582)
This commit is contained in:
parent
7e0e50f052
commit
e00a7c4d52
|
|
@ -30,9 +30,14 @@ namespace FunctionalTests
|
||||||
var hostBuilder = new WebHostBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.ConfigureLogging(factory =>
|
.ConfigureLogging(factory =>
|
||||||
{
|
{
|
||||||
factory.AddConsole(options => options.IncludeScopes = true);
|
factory.AddConsole(options =>
|
||||||
|
{
|
||||||
|
options.IncludeScopes = true;
|
||||||
|
options.TimestampFormat = "[HH:mm:ss] ";
|
||||||
|
options.UseUtcTimestamp = true;
|
||||||
|
});
|
||||||
factory.AddDebug();
|
factory.AddDebug();
|
||||||
factory.SetMinimumLevel(LogLevel.Information);
|
factory.SetMinimumLevel(LogLevel.Debug);
|
||||||
})
|
})
|
||||||
.UseKestrel((builderContext, options) =>
|
.UseKestrel((builderContext, options) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
@ -104,7 +105,7 @@ namespace FunctionalTests
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logger)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|
@ -120,6 +121,7 @@ namespace FunctionalTests
|
||||||
var originHeader = context.Request.Headers[HeaderNames.Origin];
|
var originHeader = context.Request.Headers[HeaderNames.Origin];
|
||||||
if (!StringValues.IsNullOrEmpty(originHeader))
|
if (!StringValues.IsNullOrEmpty(originHeader))
|
||||||
{
|
{
|
||||||
|
logger.LogInformation("Setting CORS headers.");
|
||||||
context.Response.Headers[HeaderNames.AccessControlAllowOrigin] = originHeader;
|
context.Response.Headers[HeaderNames.AccessControlAllowOrigin] = originHeader;
|
||||||
context.Response.Headers[HeaderNames.AccessControlAllowCredentials] = "true";
|
context.Response.Headers[HeaderNames.AccessControlAllowCredentials] = "true";
|
||||||
|
|
||||||
|
|
@ -138,6 +140,7 @@ namespace FunctionalTests
|
||||||
|
|
||||||
if (HttpMethods.IsOptions(context.Request.Method))
|
if (HttpMethods.IsOptions(context.Request.Method))
|
||||||
{
|
{
|
||||||
|
logger.LogInformation("Setting '204' CORS response.");
|
||||||
context.Response.StatusCode = StatusCodes.Status204NoContent;
|
context.Response.StatusCode = StatusCodes.Status204NoContent;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue