예제 #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"));
 }