public LoggableException(Exception ex) { Data = ex.Data; Message = ex.Message; Source = ex.Source; StackTrace = ex.StackTrace; TargetSite = ex.TargetSite; ExceptionTypeName = ex.GetType().FullName; if (ex.InnerException != null) { InnerException = new LoggableException(ex.InnerException); } }
public ILoggingEventPropertiesBuilder WithException(Exception exception) { LogEventType = GetLogType(exception); _props["LogType"] = LogEventType.ToString(); if (exception != null) { _props["Exception"] = new LoggableException(exception); var httpException = exception as HttpException; if (httpException != null) { _props["ExceptionMessage"] = httpException.Message; _props["ErrorCode"] = httpException.ErrorCode; } } return(this); }