private int Count(ScopeNode node) { if (node == null) { return 0; } var sum = node.Messages.Count; foreach (var child in node.Children) { sum += Count(child); } return sum; }
private int Count(ScopeNode node) { if (node == null) { return(0); } var sum = node.Messages.Count; foreach (var child in node.Children) { sum += Count(child); } return(sum); }
private ScopeNode CollapseHelper(ScopeNode node) { if (node == null) { return(node); } for (int i = 0; i < node.Children.Count; i++) { node.Children[i] = CollapseHelper(node.Children[i]); } node.Children.RemoveAll(c => c == null); if (node.Children.Count == 0 && node.Messages.Count == 0) { return(null); } else { return(node); } }
private void CopyScopeNodeTree(ScopeNode root, ScopeNodeDto rootDto) { rootDto.LoggerName = root.Name; rootDto.State = root.State; rootDto.StateType = root.State?.GetType(); foreach (var logInfo in root.Messages) { rootDto.Messages.Add(GetLogInfoDto(logInfo)); } foreach (var scopeNode in root.Children) { ScopeNodeDto childDto = new ScopeNodeDto(); CopyScopeNodeTree(scopeNode, childDto); rootDto.Children.Add(childDto); } }
Traverse(ScopeNode node, int level, Dictionary<string, int> counts) { #line default #line hidden return new HelperResult((__razor_helper_writer) => { #line 43 "LogPage.cshtml" // print start of scope #line default #line hidden #line 45 "LogPage.cshtml" WriteTo(__razor_helper_writer, LogRow(new LogInfo() { Name = node.Name, Time = node.StartTime, Severity = LogLevel.Verbose, Message = "Beginning " + node.State, }, level)); #line default #line hidden #line 51 "LogPage.cshtml" ; var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { #line default #line hidden #line 58 "LogPage.cshtml" WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex], level)); #line default #line hidden #line 58 "LogPage.cshtml" counts[node.Messages[messageIndex].Severity.ToString()]++; messageIndex++; } else { #line default #line hidden #line 64 "LogPage.cshtml" WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex], level + 1, counts)); #line default #line hidden #line 64 "LogPage.cshtml" childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { #line default #line hidden #line 72 "LogPage.cshtml" WriteTo(__razor_helper_writer, LogRow(node.Messages[i], level)); #line default #line hidden #line 72 "LogPage.cshtml" counts[node.Messages[i].Severity.ToString()]++; } } else { for (var i = childIndex; i < node.Children.Count; i++) { #line default #line hidden #line 80 "LogPage.cshtml" WriteTo(__razor_helper_writer, Traverse(node.Children[i], level + 1, counts)); #line default #line hidden #line 80 "LogPage.cshtml" } } // print end of scope #line default #line hidden #line 84 "LogPage.cshtml" WriteTo(__razor_helper_writer, LogRow(new LogInfo() { Name = node.Name, Time = node.EndTime, Severity = LogLevel.Verbose, Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime) }, level)); #line default #line hidden #line 90 "LogPage.cshtml" ; #line default #line hidden } ); #line 91 "LogPage.cshtml" }
public HelperResult Traverse(ScopeNode node) { return new HelperResult((writer) => { var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { LogRow(node.Messages[messageIndex]); messageIndex++; } else { Traverse(node.Children[childIndex]); childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { LogRow(node.Messages[i]); } } else { for (var i = childIndex; i < node.Children.Count; i++) { Traverse(node.Children[i]); } } }); }
private List<LogInfo> NodeLogs(ScopeNode node, List<LogInfo> logs) { if (node != null) { logs.AddRange(node.Messages); foreach (var child in node.Children) { NodeLogs(child, logs); } } return logs; }
private ScopeNode CollapseHelper(ScopeNode node) { if (node == null) { return node; } for (int i = 0; i < node.Children.Count; i++) { node.Children[i] = CollapseHelper(node.Children[i]); } node.Children.RemoveAll(c => c == null); if (node.Children.Count == 0 && node.Messages.Count == 0) { return null; } else { return node; } }
Traverse(ScopeNode node) { #line default #line hidden return new HelperResult((__razor_helper_writer) => { #line 36 "DetailsPage.cshtml" var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { #line default #line hidden #line 43 "DetailsPage.cshtml" WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex])); #line default #line hidden #line 43 "DetailsPage.cshtml" messageIndex++; } else { #line default #line hidden #line 48 "DetailsPage.cshtml" WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex])); #line default #line hidden #line 48 "DetailsPage.cshtml" childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { #line default #line hidden #line 56 "DetailsPage.cshtml" WriteTo(__razor_helper_writer, LogRow(node.Messages[i])); #line default #line hidden #line 56 "DetailsPage.cshtml" } } else { for (var i = childIndex; i < node.Children.Count; i++) { #line default #line hidden #line 63 "DetailsPage.cshtml" WriteTo(__razor_helper_writer, Traverse(node.Children[i])); #line default #line hidden #line 63 "DetailsPage.cshtml" } } #line default #line hidden } ); #line 66 "DetailsPage.cshtml" }
public HelperResult Traverse(ScopeNode node, int level, Dictionary<string, int> counts) { return new HelperResult((writer) => { // print start of scope WriteTo(writer, LogRow(new LogInfo() { Name = node.Name, Time = node.StartTime, Severity = LogLevel.Verbose, Message = "Beginning " + node.State, }, level)); var messageIndex = 0; var childIndex = 0; while (messageIndex < node.Messages.Count && childIndex < node.Children.Count) { if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime) { WriteTo(writer, LogRow(node.Messages[messageIndex], level)); counts[node.Messages[messageIndex].Severity.ToString()]++; messageIndex++; } else { WriteTo(writer, Traverse(node.Children[childIndex], level + 1, counts)); childIndex++; } } if (messageIndex < node.Messages.Count) { for (var i = messageIndex; i < node.Messages.Count; i++) { WriteTo(writer, LogRow(node.Messages[i], level)); counts[node.Messages[i].Severity.ToString()]++; } } else { for (var i = childIndex; i < node.Children.Count; i++) { WriteTo(writer, Traverse(node.Children[i], level + 1, counts)); } } // print end of scope WriteTo(writer, LogRow(new LogInfo() { Name = node.Name, Time = node.EndTime, Severity = LogLevel.Verbose, Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime) }, level)); }); }