Esempio n. 1
0
 /// <summary>
 /// 设定当前日志等级
 /// </summary>
 ///
 /// <param name="l"></param>
 public void SetLevel(int l)
 {
     if (l == Level.DEBUG.level)
     {
         this.level = Level.DEBUG;
     }
     else if (l == Level.INFO.level)
     {
         this.level = Level.INFO;
     }
     else if (l == Level.WARN.level)
     {
         this.level = Level.WARN;
     }
     else if (l == Level.ERROR.level)
     {
         this.level = Level.ERROR;
     }
     else if (l == Level.IGNORE.level)
     {
         this.level = Level.IGNORE;
     }
     else if (l == Level.ALL.level)
     {
         this.level = Level.ALL;
     }
     else
     {
         throw new ArgumentException("Levels of error messages !");
     }
 }
Esempio n. 2
0
 public void LogLevel(Level level)
 {
     log.SetLevel(level);
 }
Esempio n. 3
0
 public void SetLevel(Level l)
 {
     this.level = l;
 }
Esempio n. 4
0
 public Log(string a, int type)
 {
     this.level = Level.ALL;
     this.logFormat = new LogFormat(true, type);
     this.app = a;
 }
Esempio n. 5
0
 private void AddLogMessage(string message, Level l,
         Exception throwable)
 {
     if (message == null)
     {
         message = "";
     }
     string text = message;
     if (throwable != null)
     {
         text += " " + throwable.ToString();
     }
     newestMessageIndex = (newestMessageIndex + 1) % MAX_LOG_MESSAGES;
     if (newestMessageIndex == oldestMessageIndex)
     {
         store[newestMessageIndex].SetLogMessage(l, text);
         oldestMessageIndex = (oldestMessageIndex + 1) % MAX_LOG_MESSAGES;
     }
     else
     {
         store[newestMessageIndex] = new LogMessage(l, text);
         if (oldestMessageIndex < 0)
         {
             oldestMessageIndex = 0;
         }
     }
     LogMessage log = store[newestMessageIndex];
     logFormat.Out(log.time, app, log.level.levelString, log.message);
 }