private LogNode ParseLogNodeWithType(LogNodeType type) { switch (_scanner.Token) { case MessageToken _: Consume <MessageToken>(); return(new MessageNode(type)); case WarningToken _: Consume <WarningToken>(); return(new WarningNode(type)); case ErrorToken _: Consume <ErrorToken>(); return(new ErrorNode(type)); default: throw new ParseException(_scanner.Expression); } }
public MessageNode(LogNodeType type) : base(type) { }
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 WarningNode(LogNodeType type) : base(type) { }
public ErrorNode(LogNodeType type) : base(type) { }
public LogNode(LogNodeType type) : base() { Type = type; }