void AddLogText(string text, LoggerLevel level = LoggerLevel.Info) { if (level == LoggerLevel.Log && !Server.MineNETConfig.EnableDebugLog && !this.UseGUI) { return; } if (Server.MineNETConfig.EnableConsoleOutput) { LoggerInfo info = new LoggerInfo(); info.Level = level; info.Text = text; this.loggerTexts.Enqueue(info); } }
public virtual void Update() { if (this.loggerTexts.Count == 0) { return; } for (int i = 0; i < 10; ++i) { if (this.loggerTexts.Count == 0) { return; } LoggerInfo info = null; this.loggerTexts.TryDequeue(out info); if (info != null) { string log = info.Text; if (!this.UseGUI) { this.CUIFormat(log); } else { RemoveColorCode(ref log); info.Text = log; this.GuiLoggerTexts.Enqueue(info); } if (info.Level != LoggerLevel.Log) { this.WriteLog(log); } } } }