Skip to content

Commit e00a7c4

Browse files
Increase logging in TS functional tests (#19582)
1 parent 7e0e50f commit e00a7c4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/SignalR/clients/ts/FunctionalTests/Program.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ public static void Main(string[] args)
3030
var hostBuilder = new WebHostBuilder()
3131
.ConfigureLogging(factory =>
3232
{
33-
factory.AddConsole(options => options.IncludeScopes = true);
33+
factory.AddConsole(options =>
34+
{
35+
options.IncludeScopes = true;
36+
options.TimestampFormat = "[HH:mm:ss] ";
37+
options.UseUtcTimestamp = true;
38+
});
3439
factory.AddDebug();
35-
factory.SetMinimumLevel(LogLevel.Information);
40+
factory.SetMinimumLevel(LogLevel.Debug);
3641
})
3742
.UseKestrel((builderContext, options) =>
3843
{

src/SignalR/clients/ts/FunctionalTests/Startup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.AspNetCore.SignalR;
1919
using Microsoft.Extensions.DependencyInjection;
2020
using Microsoft.Extensions.Hosting;
21+
using Microsoft.Extensions.Logging;
2122
using Microsoft.Extensions.Primitives;
2223
using Microsoft.IdentityModel.Tokens;
2324
using Microsoft.Net.Http.Headers;
@@ -104,7 +105,7 @@ public void ConfigureServices(IServiceCollection services)
104105
});
105106
}
106107

107-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
108+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logger)
108109
{
109110
if (env.IsDevelopment())
110111
{
@@ -120,6 +121,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
120121
var originHeader = context.Request.Headers[HeaderNames.Origin];
121122
if (!StringValues.IsNullOrEmpty(originHeader))
122123
{
124+
logger.LogInformation("Setting CORS headers.");
123125
context.Response.Headers[HeaderNames.AccessControlAllowOrigin] = originHeader;
124126
context.Response.Headers[HeaderNames.AccessControlAllowCredentials] = "true";
125127

@@ -138,6 +140,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
138140

139141
if (HttpMethods.IsOptions(context.Request.Method))
140142
{
143+
logger.LogInformation("Setting '204' CORS response.");
141144
context.Response.StatusCode = StatusCodes.Status204NoContent;
142145
return Task.CompletedTask;
143146
}

0 commit comments

Comments
 (0)