/// <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 !"); } }
public void LogLevel(Level level) { log.SetLevel(level); }
public void SetLevel(Level l) { this.level = l; }
public Log(string a, int type) { this.level = Level.ALL; this.logFormat = new LogFormat(true, type); this.app = a; }
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); }