/// <summary> /// Sets the EventCount to 0 and LastEvent to null /// </summary> public void ResetEventCountAndLastEvent() { EventCount = 0; LastEvent = null; SecondLast = null; ThirdLast = null; }
/// <summary> /// Sets the EventCount to 0 and LastEvent to null /// </summary> public void ResetEventCountAndLastEvent() { EventCount = 0; LastEvent = null; #if DEBUG SecondLast = null; ThirdLast = null; #endif }
private void UpdateLastEvent(DiagnosticSourceEvent anEvent) { if (Filter != null && !Filter(anEvent)) { return; } ThirdLast = SecondLast; SecondLast = LastEvent; EventCount++; LastEvent = anEvent; }
protected override void OnEventWritten(EventWrittenEventArgs eventData) { bool wroteEvent = false; var eventWritten = EventWritten; if (eventWritten != null) { if (eventData.Payload.Count == 3 && (eventData.EventName == "Event" || eventData.EventName.Contains("Activity"))) { Debug.Assert(eventData.PayloadNames[0] == "SourceName"); Debug.Assert(eventData.PayloadNames[1] == "EventName"); Debug.Assert(eventData.PayloadNames[2] == "Arguments"); var anEvent = new DiagnosticSourceEvent(); anEvent.EventSourceEventName = eventData.EventName; anEvent.SourceName = eventData.Payload[0].ToString(); anEvent.EventName = eventData.Payload[1].ToString(); anEvent.Arguments = new Dictionary <string, string>(); var asKeyValueList = eventData.Payload[2] as IEnumerable <object>; if (asKeyValueList != null) { foreach (IDictionary <string, object> keyvalue in asKeyValueList) { object key; keyvalue.TryGetValue("Key", out key); object value; keyvalue.TryGetValue("Value", out value); if (key != null && value != null) { anEvent.Arguments[key.ToString()] = value.ToString(); } } } eventWritten(anEvent); wroteEvent = true; } } if (eventData.EventName == "EventSourceMessage" && 0 < eventData.Payload.Count) { System.Diagnostics.Debug.WriteLine("EventSourceMessage: " + eventData.Payload[0].ToString()); } var otherEventWritten = OtherEventWritten; if (otherEventWritten != null && !wroteEvent) { otherEventWritten(eventData); } }
protected override void OnEventWritten(EventWrittenEventArgs eventData) { bool wroteEvent = false; var eventWritten = EventWritten; if (eventWritten != null) { if (eventData.Payload.Count == 3 && (eventData.EventName == "Event" || eventData.EventName.Contains("Activity"))) { Debug.Assert(eventData.PayloadNames[0] == "SourceName"); Debug.Assert(eventData.PayloadNames[1] == "EventName"); Debug.Assert(eventData.PayloadNames[2] == "Arguments"); var anEvent = new DiagnosticSourceEvent(); anEvent.EventSourceEventName = eventData.EventName; anEvent.SourceName = eventData.Payload[0].ToString(); anEvent.EventName = eventData.Payload[1].ToString(); anEvent.Arguments = new Dictionary<string, string>(); var asKeyValueList = eventData.Payload[2] as IEnumerable<object>; if (asKeyValueList != null) { foreach (IDictionary<string, object> keyvalue in asKeyValueList) { object key; keyvalue.TryGetValue("Key", out key); object value; keyvalue.TryGetValue("Value", out value); if (key != null && value != null) anEvent.Arguments[key.ToString()] = value.ToString(); } } eventWritten(anEvent); wroteEvent = true; } } if (eventData.EventName == "EventSourceMessage" && 0 < eventData.Payload.Count) System.Diagnostics.Debug.WriteLine("EventSourceMessage: " + eventData.Payload[0].ToString()); var otherEventWritten = OtherEventWritten; if (otherEventWritten != null && !wroteEvent) otherEventWritten(eventData); }
private void UpdateLastEvent(DiagnosticSourceEvent anEvent) { if (Filter != null && !Filter(anEvent)) return; #if DEBUG ThirdLast = SecondLast; SecondLast = LastEvent; #endif EventCount++; LastEvent = anEvent; }
/// <summary> /// Sets the EventCount to 0 and LastEvent to null /// </summary> public void ResetEventCountAndLastEvent() { EventCount = 0; LastEvent = null; #if DEBUG SecondLast = null; ThirdLast = null; #endif }