/// <summary> /// Reads the log item fields from the specified log file reader. /// </summary> /// <param name="reader">The log file reader to read from.</param> /// <param name="isRepeated">true if the log item is repeated from a previous file, false if it is written for the first time.</param> /// <returns>The read log item.</returns> internal static FieldLogScopeItem Read(FieldLogFileReader reader, bool isRepeated) { FieldLogScopeItem item = new FieldLogScopeItem(); item.ReadBaseData(reader); item.IsRepeated = isRepeated; item.Type = (FieldLogScopeType)reader.ReadByte(); item.Level = reader.ReadInt32(); item.Name = reader.ReadString(); if (item.Type == FieldLogScopeType.ThreadStart) { byte flags = reader.ReadByte(); item.IsBackgroundThread = (flags & 1) != 0; item.IsPoolThread = (flags & 2) != 0; } if (item.Type == FieldLogScopeType.LogStart) { item.EnvironmentData = FieldLogEventEnvironment.Read(reader); } if (item.Type == FieldLogScopeType.WebRequestStart && reader.FormatVersion >= 2) { item.WebRequestData = FieldLogWebRequestData.Read(reader); } return(item); }
public FieldLogScopeItemViewModel(FieldLogScopeItem item) { this.Item = item; base.Item = item; this.EnvironmentVM = new FieldLogEnvironmentViewModel(item.EnvironmentData, this); this.WebRequestDataVM = new FieldLogWebRequestDataViewModel(item.WebRequestData, this); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="source">The FieldLogScopeItem instance to copy from.</param> internal FieldLogScopeItem(FieldLogScopeItem source) : base(source) { Type = source.Type; Level = source.Level; Name = source.Name; IsBackgroundThread = source.IsBackgroundThread; IsPoolThread = source.IsPoolThread; EnvironmentData = source.EnvironmentData; WebRequestData = source.WebRequestData; WasWritten = source.WasWritten; IsRepeated = source.IsRepeated; Thread = source.Thread; }
/// <summary> /// Reads a log item from the log file. /// </summary> /// <param name="reader">Log file reader.</param> /// <param name="type">The type of log item to read.</param> /// <returns>The read log item.</returns> internal static FieldLogItem Read(FieldLogFileReader reader, FieldLogItemType type) { switch (type) { case FieldLogItemType.Text: return(FieldLogTextItem.Read(reader)); case FieldLogItemType.Data: return(FieldLogDataItem.Read(reader)); case FieldLogItemType.Exception: return(FieldLogExceptionItem.Read(reader)); case FieldLogItemType.Scope: case FieldLogItemType.RepeatedScope: return(FieldLogScopeItem.Read(reader, type == FieldLogItemType.RepeatedScope)); } throw new ArgumentException("Unsupported log item type (" + (int)type + ")"); }
/// <summary> /// Reads the log item fields from the specified log file reader. /// </summary> /// <param name="reader">The log file reader to read from.</param> /// <param name="isRepeated">true if the log item is repeated from a previous file, false if it is written for the first time.</param> /// <returns>The read log item.</returns> internal static FieldLogScopeItem Read(FieldLogFileReader reader, bool isRepeated) { FieldLogScopeItem item = new FieldLogScopeItem(); item.ReadBaseData(reader); item.IsRepeated = isRepeated; item.Type = (FieldLogScopeType)reader.ReadByte(); item.Level = reader.ReadInt32(); item.Name = reader.ReadString(); if (item.Type == FieldLogScopeType.ThreadStart) { byte flags = reader.ReadByte(); item.IsBackgroundThread = (flags & 1) != 0; item.IsPoolThread = (flags & 2) != 0; } if (item.Type == FieldLogScopeType.LogStart) { item.EnvironmentData = FieldLogEventEnvironment.Read(reader); } if (item.Type == FieldLogScopeType.WebRequestStart && reader.FormatVersion >= 2) { item.WebRequestData = FieldLogWebRequestData.Read(reader); } return item; }