예제 #1
0
 private void Log(log4net.ILog logger, LogLevel logLevel, string message, Exception excpetion)
 {
     switch (logLevel)
     {
         case LogLevel.Debug:
             if (logger.IsDebugEnabled)
                 logger.Debug(message, excpetion);
             break;
         case LogLevel.Info:
             if (logger.IsInfoEnabled)
                 logger.Info(message, excpetion);
             break;
         case LogLevel.Warn:
             if (logger.IsWarnEnabled)
                 logger.Warn(message, excpetion);
             break;
         case LogLevel.Error:
             if (logger.IsErrorEnabled)
                 logger.Error(message, excpetion);
             break;
         case LogLevel.Fatal:
             if (logger.IsFatalEnabled)
                 logger.Fatal(message, excpetion);
             break;
         case LogLevel.Off:
             break;
         default:
             throw new Exception(string.Format("Unrecognized log level '{0}'.", logLevel.ToString()));
     }
 }