private string Body() { var builder = new System.Text.StringBuilder(); builder.AppendLine("<h2>Overall</h2>"); builder.AppendFormat("Total connections received: {0}<br />", Logger.TotalConnectionsReceived); builder.AppendLine("<h2>Request Times</h2>"); builder.AppendLine("<table id=\"request_times\"><tr><th>Path</th><th>Method</th><th>Number of requests</th><th></th></tr>"); int i = 0; foreach (var time in Logger.GetAllRequestTimes()) { string row_class = (i % 2 == 0) ? "even_row" : "odd_row"; builder.AppendFormat("<tr class=\"{0}\"><td>{1}</td><td>{2}</td><td>{3}</td><td class=\"see_details\">details</td></tr>\n", row_class, HtmlEncode(time.RelativePath), HtmlEncode(time.HttpMethod), time.NumRequests); // Now the line with more data builder.AppendFormat("<tr class=\"row_data\"><td colspan=\"4\"><div style=\"padding-left: 10px;\">Minimum time: {0}ms<br />Maximum time: {1}ms<br/>Average time: {2}ms</div></td></tr>\n", time.MinimumTime.TotalMilliseconds, time.MaximumTime.TotalMilliseconds, time.AverageTime.TotalMilliseconds); i++; } builder.Append("</table>\n"); builder.Append("<h2>Application Errors</h2>"); builder.AppendLine("<table id=\"application_errors\"><tr><th>Path</th><th>Method</th><th>Error</th><th></th></tr>"); i = 0; foreach (var error in Logger.GetAllApplicationErrors()) { string row_class = (i % 2 == 0) ? "even_row" : "odd_row"; builder.AppendFormat("<tr class=\"{0}\"><td>{1}</td><td>{2}</td><td>{3}</td><td class=\"see_details\">details</td></tr>\n", row_class, HtmlEncode(error.RelativePath), HtmlEncode(error.HttpMethod), HtmlEncode(error.Error.Message)); // Now the line with more data builder.AppendFormat("<tr class=\"row_data\"><td colspan=\"4\"><div style=\"padding-left: 10px;\">{0}</div></td></tr>\n", error.Error.ToString()); i++; } builder.Append("</table>\n"); builder.Append("<h2>Server Errors</h2>"); builder.AppendLine("<table id=\"server_errors\"><tr><th>Type</th><th></th></tr>"); i = 0; foreach (var error in Logger.GetAllServerErrors()) { string row_class = (i % 2 == 0) ? "even_row" : "odd_row"; builder.AppendFormat("<tr class=\"{0}\"><td>{1}</td><td class=\"see_details\">details</td></tr>\n", row_class, HtmlEncode(error.GetType().ToString())); // Now the line with more data builder.AppendFormat("<tr class=\"row_data\"><td colspan=\"4\"><div style=\"padding-left: 10px;\">{0}</div></td></tr>\n", HtmlEncode(error.ToString())); i++; } builder.Append("</table>\n"); return(builder.ToString()); }