public async Task Invoke(HttpContext context)
 {
     try
     {
         await _next(context);
     }
     catch (Exception e)
     {
         ELClient.WriteException(e);
         await context.Response.WriteAsync($"<b>Oops!</b> {e.ToString()}");
     }
 }
示例#2
0
        public ActionResult <IEnumerable <string> > Get()
        {
            List <KeyValuePair <string, object> > extras = new List <KeyValuePair <string, object> >();

            for (int i = 0; i < 5; i++)
            {
                extras.Add(new KeyValuePair <string, object>("num" + i, i));
            }
            try
            {
                ELClient.WriteLog("GET", "test exceptionless log...", LogLevel.Debug,
                                  new string[] { ".netcore", "exception" }, extras);

                int[] a = new int[5];
                a[5] = 1;
            }
            catch (Exception e)
            {
                ELClient.WriteException(e, new string[] { "e1", "e2" }, extras);
            }
            return(new string[] { "value1", "value2" });
        }