/// <summary> /// Initialises a new instance of the FieldLogExceptionItem class. /// </summary> /// <param name="priority">The priority of the new log item.</param> /// <param name="type">The scope type.</param> /// <param name="name">The scope name.</param> /// <param name="webRequestData">The web request data. This parameter is required for the WebRequestStart scope type.</param> public FieldLogScopeItem(FieldLogPriority priority, FieldLogScopeType type, string name, FieldLogWebRequestData webRequestData) : base(priority) { Type = type; Level = FL.ScopeLevel; Name = name; if (Type == FieldLogScopeType.ThreadStart) { IsBackgroundThread = Thread.CurrentThread.IsBackground; IsPoolThread = Thread.CurrentThread.IsThreadPoolThread; Thread = Thread.CurrentThread; } if (Type == FieldLogScopeType.LogStart) { EnvironmentData = FieldLogEventEnvironment.Current(); Size += EnvironmentData.Size; } if (Type == FieldLogScopeType.WebRequestStart) { if (webRequestData == null) { throw new ArgumentNullException("webRequestData", "The webRequestData parameter is required for the WebRequestStart scope type."); } WebRequestData = webRequestData; Size += WebRequestData.Size; } Size += 4 + 4 + (Name != null ? Name.Length * 2 : 0) + 4 + 4 + 4 + 4 + 4; }
private bool CompareScopeType(FieldLogScopeType scopeType) { FieldLogScopeType filterScopeType; if (Enum.TryParse(Value, out filterScopeType)) { switch (Comparison) { case FilterComparison.Equals: case FilterComparison.NotEquals: return scopeType == filterScopeType; default: throw new Exception("Invalid comparison for ScopeType column: " + Comparison); } } else { // Invalid value for ScopeType column return false; } }
/// <summary> /// Initialises a new instance of the FieldLogExceptionItem class. /// </summary> /// <param name="priority">The priority of the new log item.</param> /// <param name="type">The scope type.</param> /// <param name="name">The scope name.</param> public FieldLogScopeItem(FieldLogPriority priority, FieldLogScopeType type, string name) : this(priority, type, name, null) { }
/// <summary> /// Initialises a new instance of the FieldLogExceptionItem class with Trace priority. /// </summary> /// <param name="type">The scope type.</param> /// <param name="name">The scope name.</param> public FieldLogScopeItem(FieldLogScopeType type, string name) : this(FieldLogPriority.Trace, type, name) { }
/// <summary> /// Initialises a new instance of the FieldLogExceptionItem class. /// </summary> /// <param name="priority">The priority of the new log item.</param> /// <param name="type">The scope type.</param> /// <param name="name">The scope name.</param> /// <param name="webRequestData">The web request data. This parameter is required for the WebRequestStart scope type.</param> public FieldLogScopeItem(FieldLogPriority priority, FieldLogScopeType type, string name, FieldLogWebRequestData webRequestData) : base(priority) { Type = type; Level = FL.ScopeLevel; Name = name; if (Type == FieldLogScopeType.ThreadStart) { IsBackgroundThread = Thread.CurrentThread.IsBackground; IsPoolThread = Thread.CurrentThread.IsThreadPoolThread; Thread = Thread.CurrentThread; } if (Type == FieldLogScopeType.LogStart) { EnvironmentData = FieldLogEventEnvironment.Current(); Size += EnvironmentData.Size; } if (Type == FieldLogScopeType.WebRequestStart) { if (webRequestData == null) throw new ArgumentNullException("webRequestData", "The webRequestData parameter is required for the WebRequestStart scope type."); WebRequestData = webRequestData; Size += WebRequestData.Size; } Size += 4 + 4 + (Name != null ? Name.Length * 2 : 0) + 4 + 4 + 4 + 4 + 4; }