Пример #1
0
        /// <summary>
        /// 保存日志
        /// </summary>
        /// <param name="message">日志信息</param>
        /// <param name="messageType">日志类型</param>
        /// <param name="ex">异常</param>
        /// <param name="type">日志类型</param>
        private static void DoLog(string message, LogMessageEnum messageType, Exception ex,
                                  Type type)
        {
            switch (messageType)
            {
            case LogMessageEnum.Debug:
                loggerInfo.Debug(message, ex);
                break;

            case LogMessageEnum.Info:
                loggerInfo.Info(message, ex);
                break;

            case LogMessageEnum.Warn:
                loggerInfo.Warn(message, ex);
                break;

            case LogMessageEnum.Error:
                loggerError.Error(message, ex);
                break;

            case LogMessageEnum.Fatal:
                loggerError.Fatal(message, ex);
                break;
            }
        }
Пример #2
0
 /// <summary>
 /// 写入日志
 /// </summary>
 /// <param name="message">日志信息</param>
 /// <param name="messageType">日志类型</param>
 /// <param name="ex">异常</param>
 /// <param name="type"></param>
 private static void Write(string message, LogMessageEnum messageType, Exception ex,
                           Type type)
 {
     DoLog(message, messageType, ex, type);
 }
Пример #3
0
 /// <summary>
 /// 写入日志
 /// </summary>
 /// <param name="message">日志信息</param>
 /// <param name="messageType">日志类型</param>
 /// <param name="type"></param>
 public static void Write(string message, LogMessageEnum messageType, Type type)
 {
     DoLog(message, messageType, null, type);
 }
Пример #4
0
 /// <summary>
 /// 写入日志
 /// </summary>
 /// <param name="message">日志信息</param>
 /// <param name="messageType">日志类型</param>
 /// <param name="ex">异常</param>
 public static void Write(string message, LogMessageEnum messageType, Exception ex)
 {
     DoLog(message, messageType, ex, Type.GetType("System.Object"));
 }
Пример #5
0
 /// <summary>
 /// 写入日志
 /// </summary>
 /// <param name="message">日志信息</param>
 /// <param name="messageType">日志类型</param>
 public static void Write(string message, LogMessageEnum messageType)
 {
     DoLog(message, messageType, null, Type.GetType("System.Object"));
 }