Skip to content

Commit

Permalink
Fix interpolated strings in agent logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDesmond-ca committed Nov 29, 2024
1 parent 6002fb9 commit 7ac6bd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Agent/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions Agent/QueuedAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task PostRequests(IReadOnlyCollection<Request> 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);

Check warning on line 59 in Agent/QueuedAgent.cs

View workflow job for this annotation

GitHub Actions / Code-Quality

Use PascalCase for named placeholders. (https://rules.sonarsource.com/csharp/RSPEC-6678)

Check warning on line 59 in Agent/QueuedAgent.cs

View workflow job for this annotation

GitHub Actions / Code-Quality

Use PascalCase for named placeholders. (https://rules.sonarsource.com/csharp/RSPEC-6678)
var content = GetPostContent(requests);
var response = await _httpClient.PostAsync(_requestURL, content);
if (!response.IsSuccessStatusCode)
Expand All @@ -65,7 +65,7 @@ public async Task PostRequests(IReadOnlyCollection<Request> 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);

Check warning on line 68 in Agent/QueuedAgent.cs

View workflow job for this annotation

GitHub Actions / Code-Quality

Use PascalCase for named placeholders. (https://rules.sonarsource.com/csharp/RSPEC-6678)

Check warning on line 68 in Agent/QueuedAgent.cs

View workflow job for this annotation

GitHub Actions / Code-Quality

Use PascalCase for named placeholders. (https://rules.sonarsource.com/csharp/RSPEC-6678)
}
catch (Exception ex)
{
Expand Down

0 comments on commit 7ac6bd6

Please sign in to comment.