public static string DebugInformationBuilder()

in src/Elastic.Transport/Responses/ResponseStatics.cs [27:87]


	public static string DebugInformationBuilder(ApiCallDetails r, StringBuilder sb)
	{

		sb.AppendLine($"# Audit trail of this API call:");

		var auditTrail = (r.AuditTrail ?? Enumerable.Empty<Audit>()).ToList();

		if (!r.TransportConfiguration.DisableAuditTrail ?? true)
		{
			DebugAuditTrail(auditTrail, sb);
		}
		else
		{
			sb.AppendLine("<Audit trail not captured. Set DisableAuditTrail(false) on TransportConfiguration to capture it.>");
		}

		if (r.OriginalException != null) sb.AppendLine($"# OriginalException: {r.OriginalException}");

		if (!r.TransportConfiguration.DisableAuditTrail ?? true)
			DebugAuditTrailExceptions(auditTrail, sb);

		var response = r.ResponseBodyInBytes?.Utf8String() ?? ResponseAlreadyCaptured;
		var request = r.RequestBodyInBytes?.Utf8String() ?? RequestAlreadyCaptured;
		sb.AppendLine($"# Request:{Environment.NewLine}{request}");
		sb.AppendLine($"# Response:{Environment.NewLine}{response}");

		if (r.TcpStats != null)
		{
			sb.AppendLine("# TCP states:");
			foreach (var stat in r.TcpStats)
			{
				sb.Append("  ");
				sb.Append(stat.Key);
				sb.Append(": ");
				sb.AppendLine($"{stat.Value}");
			}
			sb.AppendLine();
		}

		if (r.ThreadPoolStats != null)
		{
			sb.AppendLine("# ThreadPool statistics:");
			foreach (var stat in r.ThreadPoolStats)
			{
				sb.Append("  ");
				sb.Append(stat.Key);
				sb.AppendLine(": ");
				sb.Append("    Busy: ");
				sb.AppendLine($"{stat.Value.Busy}");
				sb.Append("    Free: ");
				sb.AppendLine($"{stat.Value.Free}");
				sb.Append("    Min: ");
				sb.AppendLine($"{stat.Value.Min}");
				sb.Append("    Max: ");
				sb.AppendLine($"{stat.Value.Max}");
			}
			sb.AppendLine();
		}

		return sb.ToString();
	}