private LoglineObject GetLoglineObject(int index) { LogPos logPos = positionList[index]; String line = LoglineObject.ReadLine(logPos); return(LoglineObject.CreateLoglineObject(line, logPos)); }
private void listViewLog_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { LogPos logPos = positionList[e.ItemIndex]; String line = LoglineObject.ReadLine(logPos); ListViewItem lvi = new ListViewItem(); lvi.BackColor = GetAgeColor(logPos.TimeStamp); lvi.UseItemStyleForSubItems = false; LoglineObject loglineObject = LoglineObject.CreateLoglineObject(line, logPos); lvi.Text = loglineObject.Timestamp; ListViewItem.ListViewSubItem lvsuLevel = new ListViewItem.ListViewSubItem(); lvsuLevel.Text = loglineObject.Level; lvsuLevel.BackColor = loglineObject.GetLevelBackColor(); lvsuLevel.ForeColor = loglineObject.GetLevelFrontColor(); lvi.SubItems.Add(lvsuLevel); ListViewItem.ListViewSubItem lvsuDuration = new ListViewItem.ListViewSubItem(); if (loglineObject.Duration.HasValue) { lvsuDuration.Text = $"{loglineObject.Duration.Value:n0} ms"; if (loglineObject.Duration.Value > 1000) { lvsuDuration.BackColor = loglineObject.Duration.Value > 5000 ? Color.LightCoral : Color.LightYellow; } } lvi.SubItems.Add(lvsuDuration); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = loglineObject.ClassnameShort }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = loglineObject.Message }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = loglineObject.Threadname }); lvi.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = logPos.LogSource.ToString() }); if (logPos.LoglineType == LoglineType.CHILD_LINE) { foreach (String kv in LogUtils.LineMarkerFont) { if (line.Contains(kv)) { lvi.SubItems[4].BackColor = Color.LightGreen; lvi.SubItems[4].Font = new Font(listViewLog.Font, FontStyle.Bold); } } } e.Item = lvi; }