public void PopulateFrom(ThreadLogSnapshot source) { this.TimestampValue = source.StartedAtUtc.Ticks; this.Environment = source.EnvironmentName; this.Node = source.NodeName; this.LogId = source.LogId.ToString("N"); this.ThreadType = source.TaskType; this.CorrelationId = source.CorrelationId.ToString("N"); int nodeId = 1; PopulateFrom(source.RootActivity, source.StartedAtUtc, ref nodeId); this.Type = LogNodeType.Thread; this.TimeText = source.StartedAtUtc.ToString("yyyy-MM-dd HH:mm:ss.fff"); }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void AddLog(ThreadLogSnapshot threadLog) { _pendingThreadLogs.Enqueue(threadLog); }
public void PopulateFrom(ThreadLogSnapshot.LogNodeSnapshot source, DateTime threadStartedAt, ref int nodeId) { this.Id = nodeId++; this.Type = (source.IsActivity ? LogNodeType.Activity : LogNodeType.Log); this.Icon = LogNodeIcon.None;//TODO this.Level = source.Level; this.MessageId = source.MessageId; this.Text = GetTextFromMessageId(source.MessageId); this.ExceptionDetails = source.ExceptionDetails; if ( source.NameValuePairs != null && source.NameValuePairs.Any(p => !p.IsDetail) ) { this.Text += ": " + string.Join(", ", source.NameValuePairs.Where(p => !p.IsDetail).Select(p => p.Name + "=" + p.Value)); } this.TimeText = "+ " + source.MillisecondsTimestamp.ToString("#,###"); this.Timestamp = threadStartedAt.AddMilliseconds(source.MillisecondsTimestamp).ToString("yyyy-MM-dd HH:mm:ss.fff"); this.NameValuePairs = source.NameValuePairs; if ( source.IsActivity ) { this.Duration = (int)source.Duration; } if ( source.SubNodes != null ) { var subNodeId = nodeId; this.SubNodes = source.SubNodes.Select(subSource => { var subModel = new LogNodeViewModel(); subModel.PopulateFrom(subSource, threadStartedAt, ref subNodeId); return subModel; }).ToArray(); nodeId = subNodeId; } }
public ThreadLogModelTuple(LogPanelViewModel ownerModel, ThreadLogSnapshot threadLog) { this.ThreadLog = threadLog; this.ViewModel = new ThreadLogViewModel(threadLog); var lastTuple = ownerModel._threadLogModelTuples.LastOrDefault(); this.RootNodeItem = new TreeNodeItem<ThreadLogViewModel.NodeItem>( ViewModel.RootActivity, ownerModel.Items, parentNode: null, prevSiblingNode: (lastTuple != null ? lastTuple.RootNodeItem : null)); }