Beispiel #1
0
        private void LogRequestDetails(Action <Enum, string> logDetail, Roundtrip roundtrip, bool exceptionThrown)
        {
            string arg = string.Join(" ", from request in roundtrip.RequestBatch.Requests
                                     select CobaltStore.GetRequestNameAndPartition(request));

            logDetail(WacRequestHandlerMetadata.CobaltOperations, arg);
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;

            foreach (Request request2 in roundtrip.RequestBatch.Requests)
            {
                if (request2.Failed)
                {
                    flag = true;
                    stringBuilder.Append(request2.GetType().Name);
                    stringBuilder.Append(" failed. ");
                    try
                    {
                        string conciseLoggingStatement = Log.GetConciseLoggingStatement(request2, this.userAddress);
                        if (exceptionThrown || request2.Failed)
                        {
                            stringBuilder.AppendLine(conciseLoggingStatement);
                        }
                    }
                    catch (ErrorException)
                    {
                        stringBuilder.AppendLine("Concise logging not supported.");
                    }
                }
            }
            try
            {
                roundtrip.ThrowIfAnyError();
            }
            catch (Exception ex)
            {
                exceptionThrown = true;
                stringBuilder.AppendLine("ThrowIfAnyError: " + ex.ToString());
            }
            if (exceptionThrown || flag)
            {
                logDetail(WacRequestHandlerMetadata.ErrorDetails, stringBuilder.ToString());
            }
        }