Exemplo n.º 1
0
        public bool SendSubmissionLog(SubmissionLog log)
        {
            string endpoint        = buildEndpoint("submissions", log.SubmissionId, "logs");
            var    responseMessage = client.PostAsync(endpoint, log.AsJson()).Result;

            logger.Debug("{1} log for submission {0} send {2}", log.SubmissionId,
                         log.Type.ToString(), responseMessage.StatusCode == HttpStatusCode.NoContent ?
                         "successfully" : "failed");

            if (responseMessage.StatusCode != HttpStatusCode.NoContent)
            {
                logger.Error("Sending submission log failed. Server error message: {0}",
                             responseMessage.Content?.ReadAsStringAsync()?.Result);
            }

            return(responseMessage.StatusCode == HttpStatusCode.NoContent);
        }
Exemplo n.º 2
0
 public RequestMessage GetSendLogRequestMessage(SubmissionLog log) =>
 new RequestMessage(buildEndpoint("submissions", log.SubmissionId, "logs"), log.AsJson());