Skip to content

Commit

Permalink
Adds Collective2 Payload To Logs With Debugging Enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCatarino committed Jan 28, 2025
1 parent 9b35411 commit 2ddc515
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,17 @@ private bool SendPositions(string message)
//Parse it
var responseObject = response.Content.ReadFromJsonAsync<C2Response>().Result;

//For debugging purposes, append the message sent to Collective2 to the algorithms log
var debuggingMessage = Logging.Log.DebuggingEnabled ? $" | Message={message}" : string.Empty;

if (!response.IsSuccessStatusCode)
{
_algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}");
_algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}{debuggingMessage}");
return false;
}
else if (responseObject.Results.Count > 0)
{
_algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}");
_algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}{debuggingMessage}");
}

return true;
Expand Down

0 comments on commit 2ddc515

Please sign in to comment.