예제 #1
0
 public static ErrorModel Create(Error error, string logId)
 {
     return(new ErrorModel
     {
         Guid = Guid.NewGuid().ToString(),
         Detail = error.Detail,
         LogId = logId,
         Host = Host(error.ServerVariables),
         Type = error.Type,
         Source = error.Source,
         Message = error.Message,
         User = error.User,
         Time = error.Time,
         StatusCode = error.StatusCode,
         ServerVariables = MonitorrHelpers.ToDictionary(error.ServerVariables),
         QueryString = MonitorrHelpers.ToDictionary(error.QueryString),
         Form = MonitorrHelpers.ToDictionary(error.Form),
         Cookies = MonitorrHelpers.ToDictionary(error.Cookies),
         Browser = Browser(error.ServerVariables),
         Severity = GetSeverity(error.StatusCode),
         Url = Url(error.ServerVariables),
         IsCustom = false,
         Method = Method(error.ServerVariables)
     });
 }
예제 #2
0
        private static Dictionary <string, string> Form(HttpContext context)
        {
            try
            {
                return(MonitorrHelpers.ToDictionary(context.Request?.Form));
            }
            catch (InvalidOperationException)
            {
            }

            return(null);
        }
예제 #3
0
 private static Dictionary <string, string> Cookies(HttpContext context)
 {
     return(MonitorrHelpers.ToDictionary(context.Request?.Cookies));
 }
예제 #4
0
 private static Dictionary <string, string> ServerVariables(HttpContext context)
 {
     return(MonitorrHelpers.ToDictionary(context.Request?.Headers));
 }
예제 #5
0
 private static Dictionary <string, string> QueryString(HttpContext context)
 {
     return(MonitorrHelpers.ToDictionary(context.Request?.QueryString));
 }