private ErrorLogModel GetErrorLogModel(Exception ex, HttpContext httpContext)
        {
            var error = new Elmah.Error(ex, httpContext);
            var log   = Elmah.ErrorLog.GetDefault(httpContext);

            error.ApplicationName = log.ApplicationName;
            var          id     = log.Log(error);
            var          entry  = new Elmah.ErrorLogEntry(log, id, error);
            StringWriter writer = new StringWriter(new StringBuilder());

            Elmah.ErrorJson.Encode(entry.Error, writer);
            var str = writer.ToString();

            return(new ErrorLogModel
            {
                AllXml = str,
                Application = entry.Error.ApplicationName,
                ErrorId = Guid.NewGuid(),
                Host = entry.Error.HostName,
                IsWeb = true,
                Message = entry.Error.Message,
                Source = entry.Error.Source,
                StatusCode = entry.Error.StatusCode,
                TimeUtc = entry.Error.Time,
                Type = entry.Error.Type,
                User = entry.Error.User,
                StoreId = SessionHelper.CurrentSession.Id
            });
        }
Пример #2
0
        public static void LogCustom(this Elmah.ErrorLogEntry entry, LogSeverity severity = LogSeverity.Error)
        {
            // set elmah id
            entry.Error.Exception.Data["ElmahId"] = entry.Id;

            // log entry
            LogCustom(entry.Error, severity);
        }
Пример #3
0
        public override System.Web.Mvc.ActionResult LoggedElmahError(Elmah.ErrorLogEntry error)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.LoggedElmahError);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "error", error);
            LoggedElmahErrorOverride(callInfo, error);
            return(callInfo);
        }
Пример #4
0
 partial void LoggedElmahErrorOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Elmah.ErrorLogEntry error);