Esempio n. 1
0
        /// <summary>
        /// 创建异常实体
        /// </summary>
        /// <param name="ex"></param>
        /// <returns></returns>
        public static LogEntity Create(Exception ex)
        {
            StringBuilder logTrackInfo = new StringBuilder();

            logTrackInfo.AppendLine(ex.Source);
            logTrackInfo.AppendLine(ex.HelpLink);
            logTrackInfo.AppendLine(ex.StackTrace);
            logTrackInfo.AppendLine(ex.TargetSite == null ? String.Empty : ex.TargetSite.ToString());

            return(Create(logTrackInfo.ToString(),
                          ex.GetMessage(),
                          LogTypeFacotry.CreateExceptionLogType(),
                          LogLevelFactory.CreateGravenessLogLevel()));
        }
Esempio n. 2
0
 /// <summary>
 /// 创建异常日志实体
 /// </summary>
 /// <param name="ex">异常信息</param>
 /// <param name="logLevel">日志级别</param>
 /// <returns></returns>
 public static LogEntity Create(Exception ex, LogLevel logLevel)
 {
     return(Create(ex.HelpLink, ex.Message, LogTypeFacotry.CreateExceptionLogType(), logLevel));
 }