public static async Task ProcessRequest(HttpContext context, ErrorLog errorLog, string elmahRoot) { const int pageSize = 15; var entries = new List <ErrorLogEntry>(pageSize); var log = errorLog; await log.GetErrorsAsync(0, pageSize, entries); var response = context.Response; response.ContentType = "application/xml"; var title = $@"Error log of {log.ApplicationName} on {Environment.MachineName}"; var link = $"{context.Request.Scheme}://{context.Request.Host}{elmahRoot}"; var baseUrl = new Uri(link.TrimEnd('/') + "/"); var items = from entry in entries let error = entry.Error select RssXml.Item( error.Message, "An error of type " + error.Type + " occurred. " + error.Message, error.Time, baseUrl + "detail?id=" + Uri.EscapeDataString(entry.Id)); var rss = RssXml.Rss(title, link, "AddMessage of recent errors", items); await response.WriteAsync(XmlText.StripIllegalXmlCharacters(rss.ToString())); }
public static async Task ProcessRequest(HttpContext context, ErrorLog errorLog, string elmahRoot) { var log = errorLog; var response = context.Response; response.ContentType = "application/xml"; var title = $@"Daily digest of errors in {log.ApplicationName} on {Environment.MachineName}"; var link = $"{context.Request.Scheme}://{context.Request.Host}{elmahRoot}"; var baseUrl = new Uri(link.TrimEnd('/') + "/"); var items = GetItems(log, baseUrl, 30, 30).Take(30); var rss = RssXml.Rss(title, link, "Daily digest of application errors", items); await context.Response.WriteAsync(XmlText.StripIllegalXmlCharacters(rss.ToString())); }