Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public MessageNode(LogNodeType type) : base(type)
 {
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
 public WarningNode(LogNodeType type) : base(type)
 {
 }
Exemplo n.º 5
0
 public ErrorNode(LogNodeType type) : base(type)
 {
 }
Exemplo n.º 6
0
 public LogNode(LogNodeType type) : base()
 {
     Type = type;
 }