private void Log(LogOutLevelType levelType, string log) { if (this.logList.Items.Count > 500) { CleanViewLog(); } var viewItem = new ListViewItem(); viewItem.Text = DateTime.Now.ToString(); viewItem.SubItems.Add(log); switch (levelType) { case LogOutLevelType.Debug: viewItem.ImageKey = "ok"; break; case LogOutLevelType.Warning: viewItem.ImageKey = "err"; break; case LogOutLevelType.Error: viewItem.ImageKey = "err"; break; } if (this.logList.Items.Count > 1) { this.logList.Items.Insert(1, viewItem); } else { this.logList.Items.Add(viewItem); } LogHelper.WriteLog($"Level:{levelType.ToString()} {log}", ApplicationConfiguration.LogFileName); }
private void LogOutputEventHandler(LogOutLevelType levelType, string log) => this.Log(levelType, log);
/// <summary> /// 输出日志 /// </summary> /// <param name="logLevel"></param> /// <param name="log"></param> protected void Log(LogOutLevelType logLevel, string log) => this.LogOutputEventHandler?.Invoke(this, logLevel, log);
private void LogOutputEventHandler(DispatcherBase dispatcher, LogOutLevelType levelType, string log) => this.Log(levelType, log);
private void ApportionDispatcher_LogOutputEventHandler(DispatcherBase dispatcher, LogOutLevelType level, string log) { LogOutputEventHandler?.Invoke(level, log); }