public void WriteTraceSource(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload) { if (this.TracingEnabled) { XPathNavigator data = null; try { string xml = BuildTrace(ref eventDescriptor, description, payload); XmlDocument document = new XmlDocument(); document.LoadXml(xml); data = document.CreateNavigator(); this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), eventDescriptor.EventId, data); if (this.calledShutdown) { this.TraceSource.Flush(); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.LogTraceFailure((data == null) ? string.Empty : data.ToString(), exception); } } }
public void WriteTraceSource(ref EventDescriptor eventDescriptor, string description, TracePayload payload) { if (this.TracingEnabled) { XPathNavigator navigator = null; try { string msdnTraceCode; int legacyEventId; EtwDiagnosticTrace.GenerateLegacyTraceCode(ref eventDescriptor, out msdnTraceCode, out legacyEventId); string traceString = BuildTrace(ref eventDescriptor, description, payload, msdnTraceCode); XmlDocument traceDocument = new XmlDocument(); traceDocument.LoadXml(traceString); navigator = traceDocument.CreateNavigator(); this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), legacyEventId, navigator); if (this.CalledShutdown) { this.TraceSource.Flush(); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } LogTraceFailure(navigator == null ? string.Empty : navigator.ToString(), exception); } } }
public bool ShouldTraceToTraceSource(TraceEventLevel eventLevel) { if (!this.HaveListeners || this.TraceSource == null) { return(false); } return((int)SourceLevels.Off != ((int)TraceLevelHelper.GetTraceEventType(eventLevel) & (int)this.Level)); }
public void WriteTraceSource(ref EventDescriptor eventDescriptor, string description, TracePayload payload) { string str = null; int num = 0; string empty; if (base.TracingEnabled) { XPathNavigator xPathNavigator = null; try { EtwDiagnosticTrace.GenerateLegacyTraceCode(ref eventDescriptor, out str, out num); string str1 = EtwDiagnosticTrace.BuildTrace(ref eventDescriptor, description, payload, str); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(str1); xPathNavigator = xmlDocument.CreateNavigator(); base.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), num, xPathNavigator); if (base.CalledShutdown) { base.TraceSource.Flush(); } } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception)) { EtwDiagnosticTrace etwDiagnosticTrace = this; if (xPathNavigator == null) { empty = string.Empty; } else { empty = xPathNavigator.ToString(); } etwDiagnosticTrace.LogTraceFailure(empty, exception); } else { throw; } } } }
public void WriteTraceSource(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload) { if (this.TracingEnabled) { XPathNavigator xPathNavigator = null; try { string str = DiagnosticTrace.BuildTrace(ref eventDescriptor, description, payload); XmlDocument xmlDocument = new XmlDocument(); StringReader stringReader = new StringReader(str); XmlReaderSettings xmlReaderSetting = new XmlReaderSettings() { DtdProcessing = DtdProcessing.Prohibit }; using (XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSetting)) { xmlDocument.Load(xmlReader); } xPathNavigator = xmlDocument.CreateNavigator(); this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), eventDescriptor.EventId, xPathNavigator); if (this.calledShutdown) { this.TraceSource.Flush(); } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } this.LogTraceFailure((xPathNavigator == null ? string.Empty : xPathNavigator.ToString()), exception); } } }
public bool ShouldTraceToTraceSource(TraceEventLevel level) { return(ShouldTrace(TraceLevelHelper.GetTraceEventType(level))); }
public bool ShouldTraceToTraceSource(TraceEventLevel eventLevel) { return(this.HaveListeners && this.TraceSource != null && 0 != ((int)TraceLevelHelper.GetTraceEventType(eventLevel) & (int)this.Level)); }
public bool ShouldTraceToTraceSource(TraceEventLevel level) { return((this.HaveListeners && (this.TraceSource != null)) && (((TraceEventType)0) != (TraceLevelHelper.GetTraceEventType(level) & ((TraceEventType)((int)this.Level))))); }