/// <summary>
        /// Gets the log as an asynchronous operation.
        /// </summary>
        /// <returns>The log as a <see cref="String"/>></returns>
        public async Task <string> GetLogStringAsync()
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                if (this.IsIncoming)
                {
                    sb.AppendLine(Constants.NotifierInboundHttpRequestResponseStart);
                }
                else
                {
                    sb.AppendLine(Constants.TransportOutboundHttpRequestResponseStart);
                }

                this.AppendResponseInfo(sb);

                HttpContent content = await this.GetHttpContentForLogAsync().ConfigureAwait(false);

                if (content != null)
                {
                    await HttpMessageHelper.FormatHttpContentAsync(sb, content).ConfigureAwait(false);
                }

                sb.AppendLine();
                if (this.IsIncoming)
                {
                    sb.AppendLine(Constants.NotifierInboundHttpRequestResponseEnd);
                }
                else
                {
                    sb.AppendLine(Constants.TransportOutboundHttpRequestResponseEnd);
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Error("Serializing http response failed.  Ex: " + ex.ToString());
            }

            return(sb.ToString());
        }
        /// <summary>
        /// Get related tracing info from header.
        /// </summary>
        /// <param name="httpHeaders">HTTP headers from request or response.</param>
        /// <param name="isFromRequest">The header is from request or response.</param>
        public void FillTracingInfoFromHeaders(HttpHeaders httpHeaders, bool isFromRequest = true)
        {
            if (httpHeaders == null)
            {
                return;
            }

            var correlationId   = HttpMessageHelper.GetHttpHeaderValue(httpHeaders, Constants.UcapMsCorrelationId);
            var serverFqdn      = HttpMessageHelper.GetHttpHeaderValue(httpHeaders, Constants.UcapMsServerFqdn);
            var clientRequestId = HttpMessageHelper.GetHttpHeaderValue(httpHeaders, Constants.UcapClientRequestId);

            if (isFromRequest)
            {
                this.PlatformEventsCorrelationId   = correlationId;
                this.PlatformEventsServerFqdn      = serverFqdn;
                this.PlatformEventsClientRequestId = clientRequestId;
                this.PlatformEventReceivedTime     = DateTime.UtcNow;
            }
            else
            {
                this.PlatformResponseCorrelationId = correlationId;
                this.PlatformResponseServerFqdn    = serverFqdn;
            }
        }