Skip to content

Commit b9a01ed

Browse files
committed
Removed some formatting code for logs.
1 parent 7541a0c commit b9a01ed

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/NonAuthClient.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -708,12 +708,8 @@ protected async Task<HttpContent> Get(string address, Func<HttpRequestMessage, s
708708
using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, address))
709709
{
710710
var authString = auth?.Invoke(request);
711-
if (!string.IsNullOrEmpty(authString))
712-
{
713-
authString = " " + authString;
714-
}
715711
var response = await _httpClient.SendAsync(request);
716-
await VerifyAndLogReponse(response, $"GET: {address}{authString}");
712+
await VerifyAndLogReponse(response, $"GET: {address} {authString}");
717713
return response.Content;
718714
}
719715
}
@@ -756,20 +752,17 @@ protected async Task<HttpContent> SendAuthRequest(HttpMethod method, string addr
756752
}
757753
}
758754

759-
protected async Task VerifyAndLogReponse(HttpResponseMessage response, string extraMessage)
755+
protected async Task VerifyAndLogReponse(HttpResponseMessage response, string logMessage)
760756
{
761-
var formattedExtraMessage = string.IsNullOrWhiteSpace(extraMessage) ? string.Empty : extraMessage + ": ";
762757
if (!response.IsSuccessStatusCode)
763758
{
764759
var message = await response.Content.ReadAsStringAsync();
765-
message = $"{formattedExtraMessage}failed: {response.StatusCode}-{response.ReasonPhrase} {message}";
766-
_logger?.LogError(message);
760+
_logger?.LogError($"{logMessage}: failed: {response.StatusCode}-{response.ReasonPhrase} {message}");
767761
throw new OsmApiException(response.RequestMessage?.RequestUri, message, response.StatusCode);
768762
}
769763
else
770764
{
771-
var message = $"{formattedExtraMessage}succeeded";
772-
_logger?.LogInformation(message);
765+
_logger?.LogInformation($"{logMessage}: succeeded");
773766
}
774767
}
775768
#endregion

0 commit comments

Comments
 (0)