Example #1
0
 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);
     }
 }
Example #2
0
        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);
        }