Skip to content

Commit 1000669

Browse files
authored
Adds Collective2 Payload To Logs With Debugging Enabled (#8559)
1 parent 24a1fbb commit 1000669

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Common/Algorithm/Framework/Portfolio/SignalExports/Collective2SignalExport.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,17 @@ private bool SendPositions(string message)
274274
//Parse it
275275
var responseObject = response.Content.ReadFromJsonAsync<C2Response>().Result;
276276

277+
//For debugging purposes, append the message sent to Collective2 to the algorithms log
278+
var debuggingMessage = Logging.Log.DebuggingEnabled ? $" | Message={message}" : string.Empty;
279+
277280
if (!response.IsSuccessStatusCode)
278281
{
279-
_algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}");
282+
_algorithm.Error($"Collective2 API returned the following errors: {string.Join(",", PrintErrors(responseObject.ResponseStatus.Errors))}{debuggingMessage}");
280283
return false;
281284
}
282285
else if (responseObject.Results.Count > 0)
283286
{
284-
_algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}");
287+
_algorithm.Debug($"Collective2: NewSignals={string.Join(',', responseObject.Results[0].NewSignals)} | CanceledSignals={string.Join(',', responseObject.Results[0].CanceledSignals)}{debuggingMessage}");
285288
}
286289

287290
return true;

0 commit comments

Comments
 (0)