From fbb13c4c1f2e6c0633b3dd39839ac3678fba2184 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Mon, 16 Apr 2018 09:38:47 +1200 Subject: [PATCH] Improve response status logging --- .../Internal/LoggingHttpMessageHandler.cs | 6 +++--- .../HubConnectionTests.cs | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/LoggingHttpMessageHandler.cs b/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/LoggingHttpMessageHandler.cs index 7d8df64783..d8a90205fa 100644 --- a/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/LoggingHttpMessageHandler.cs +++ b/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/LoggingHttpMessageHandler.cs @@ -43,8 +43,8 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal private static readonly Action _sendingHttpRequest = LoggerMessage.Define(LogLevel.Trace, new EventId(1, "SendingHttpRequest"), "Sending HTTP request {RequestMethod} '{RequestUrl}'."); - private static readonly Action _unsuccessfulHttpResponse = - LoggerMessage.Define(LogLevel.Warning, new EventId(2, "UnsuccessfulHttpResponse"), "Unsuccessful HTTP response status code of {StatusCode} return from {RequestMethod} '{RequestUrl}'."); + private static readonly Action _unsuccessfulHttpResponse = + LoggerMessage.Define(LogLevel.Warning, new EventId(2, "UnsuccessfulHttpResponse"), "Unsuccessful HTTP response {StatusCode} return from {RequestMethod} '{RequestUrl}'."); public static void SendingHttpRequest(ILogger logger, HttpMethod requestMethod, Uri requestUrl) { @@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal } public static void UnsuccessfulHttpResponse(ILogger logger, HttpStatusCode statusCode, HttpMethod requestMethod, Uri requestUrl) { - _unsuccessfulHttpResponse(logger, statusCode, requestMethod, requestUrl, null); + _unsuccessfulHttpResponse(logger, (int)statusCode, requestMethod, requestUrl, null); } } } diff --git a/test/Microsoft.AspNetCore.SignalR.Client.FunctionalTests/HubConnectionTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.FunctionalTests/HubConnectionTests.cs index 8a70874b33..9d9dc2829d 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.FunctionalTests/HubConnectionTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.FunctionalTests/HubConnectionTests.cs @@ -5,14 +5,12 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Http.Connections; using Microsoft.AspNetCore.Http.Connections.Client; -using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.AspNetCore.SignalR.Protocol; using Microsoft.AspNetCore.SignalR.Tests; using Microsoft.AspNetCore.Testing.xunit;