private IEnumerable <LogItem> buildLogs(RequestLog log) { var stack = new Stack <BehaviorNode>(); var titles = new Cache <BehaviorNode, string>(node => Description.For(node).Title); var steps = log.AllSteps().ToArray(); foreach (var step in steps) { (step.Log as BehaviorStart).CallIfNotNull(x => stack.Push(x.Correlation.Node)); var node = findNode(step, stack, steps); yield return(new LogItem { behavior = node == null ? "Unknown" : titles[node], time = step.RequestTimeInMilliseconds, html = determineHtml(step.Log) }); (step.Log as BehaviorFinish).CallIfNotNull(x => stack.Pop()); } }
public TracingOutlineTag(RequestLog log) { AddHeader("Tracing"); log.AllSteps().Each(x => { var node = addNode(x); node.Container.Add("span").AddClass("node-trace-duration").Text(x.RequestTimeInMilliseconds + " ms"); }); }
public void add_log() { var log = new RequestLog(); var stringMessage = new StringMessage("something"); log.AddLog(123.45, stringMessage); log.AddLog(234, "something"); log.AllSteps() .ShouldHaveTheSameElementsAs(new RequestStep(123.45, stringMessage), new RequestStep(234, "something")); }
private IEnumerable<LogItem> buildLogs(RequestLog log) { var stack = new Stack<BehaviorNode>(); var titles = new Cache<BehaviorNode, string>(node => Description.For(node).Title); var steps = log.AllSteps().ToArray(); foreach (var step in steps) { (step.Log as BehaviorStart).CallIfNotNull(x => stack.Push(x.Correlation.Node)); var node = findNode(step, stack, steps); yield return new LogItem { behavior = node == null ? "Unknown" : titles[node], time = step.RequestTimeInMilliseconds, html = determineHtml(step.Log) }; (step.Log as BehaviorFinish).CallIfNotNull(x => { if (stack.Any()) { stack.Pop(); } }); } }