From 7ac6bd6e24ae3cf52482707ced0bec79bfa08d63 Mon Sep 17 00:00:00 2001 From: Steve Desmond Date: Thu, 28 Nov 2024 20:33:59 -0500 Subject: [PATCH] Fix interpolated strings in agent logging messages --- Agent/Agent.cs | 2 +- Agent/QueuedAgent.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Agent/Agent.cs b/Agent/Agent.cs index fc3dc5d..9ea4bf9 100644 --- a/Agent/Agent.cs +++ b/Agent/Agent.cs @@ -31,7 +31,7 @@ public virtual async Task Send(Request request) { try { - _logger?.Log(LogLevel.Debug, $"Sending request to {_requestURL}"); + _logger?.Log(LogLevel.Debug, "Sending request to {URL}", _requestURL); var response = await _httpClient.PostAsync(_requestURL, GetPostContent(request)); if (!response.IsSuccessStatusCode) { diff --git a/Agent/QueuedAgent.cs b/Agent/QueuedAgent.cs index 95ad92a..6ed9adc 100644 --- a/Agent/QueuedAgent.cs +++ b/Agent/QueuedAgent.cs @@ -56,7 +56,7 @@ public async Task PostRequests(IReadOnlyCollection requests) _sending = true; try { - _logger?.Log(LogLevel.Debug, $"Sending {requests.Count} request{(requests.Count > 1 ? "s" : "")} to {_requestURL}"); + _logger?.Log(LogLevel.Debug, "Sending {count} request{s} to {URL}", requests.Count, requests.Count > 1 ? "s" : "", _requestURL); var content = GetPostContent(requests); var response = await _httpClient.PostAsync(_requestURL, content); if (!response.IsSuccessStatusCode) @@ -65,7 +65,7 @@ public async Task PostRequests(IReadOnlyCollection requests) } _requestQueue.RemoveAll(requests.Contains); - _logger?.Log(LogLevel.Information, $"Sent {requests.Count} request{(requests.Count > 1 ? "s" : "")} to {_requestURL}"); + _logger?.Log(LogLevel.Information, "Sent {count} request{s} to {URL}", requests.Count, requests.Count > 1 ? "s" : "", _requestURL); } catch (Exception ex) {