Exemplo n.º 1
0
        public override string ToString()
        {
            PlainXmlWriter xml = new PlainXmlWriter();

            this.WriteTo(xml);
            return(xml.ToString());
        }
 private static XPathNavigator BuildTraceString(PlainXmlWriter xml, TraceEventType type, string code, string description, TraceRecord trace, Exception exception, object source)
 {
     xml.WriteStartElement("TraceRecord");
     xml.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord");
     xml.WriteAttributeString("Severity", LookupSeverity(type));
     xml.WriteElementString("TraceIdentifier", code);
     xml.WriteElementString("Description", description);
     xml.WriteElementString("AppDomain", AppDomainFriendlyName);
     if (source != null)
     {
         xml.WriteElementString("Source", CreateSourceString(source));
     }
     if (trace != null)
     {
         xml.WriteStartElement("ExtendedData");
         xml.WriteAttributeString("xmlns", trace.EventId);
         trace.WriteTo(xml);
         xml.WriteEndElement();
     }
     if (exception != null)
     {
         xml.WriteStartElement("Exception");
         AddExceptionToTraceString(xml, exception);
         xml.WriteEndElement();
     }
     xml.WriteEndElement();
     return(xml.ToNavigator());
 }
Exemplo n.º 3
0
        static XPathNavigator BuildTraceString(PlainXmlWriter xml,
                                               TraceEventType type,
                                               string code,
                                               string description,
                                               TraceRecord trace,
                                               Exception exception,
                                               object source)
        {
            xml.WriteStartElement(DiagnosticStrings.TraceRecordTag);
            xml.WriteAttributeString(DiagnosticStrings.NamespaceTag, DiagnosticTrace.TraceRecordVersion);
            xml.WriteAttributeString(DiagnosticStrings.SeverityTag, DiagnosticTrace.LookupSeverity(type));

            xml.WriteElementString(DiagnosticStrings.TraceCodeTag, code);
            xml.WriteElementString(DiagnosticStrings.DescriptionTag, description);
            xml.WriteElementString(DiagnosticStrings.AppDomain, DiagnosticTrace.AppDomainFriendlyName);

            if (source != null)
            {
                xml.WriteElementString(DiagnosticStrings.SourceTag, DiagnosticTrace.CreateSourceString(source));
            }

            if (trace != null)
            {
                xml.WriteStartElement(DiagnosticStrings.ExtendedDataTag);
                xml.WriteAttributeString(DiagnosticStrings.NamespaceTag, trace.EventId);

                trace.WriteTo(xml);

                xml.WriteEndElement();
            }

            if (exception != null)
            {
                xml.WriteStartElement(DiagnosticStrings.ExceptionTag);
                DiagnosticTrace.AddExceptionToTraceString(xml, exception);
                xml.WriteEndElement();
            }

            xml.WriteEndElement();

            return(xml.ToNavigator());
        }
Exemplo n.º 4
0
 public override string ToString()
 {
     PlainXmlWriter xml = new PlainXmlWriter();
     WriteTo(xml);
     return xml.ToString();
 }
 private static XPathNavigator BuildTraceString(PlainXmlWriter xml, TraceEventType type, string code, string description, TraceRecord trace, Exception exception, object source)
 {
     xml.WriteStartElement("TraceRecord");
     xml.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord");
     xml.WriteAttributeString("Severity", LookupSeverity(type));
     xml.WriteElementString("TraceIdentifier", code);
     xml.WriteElementString("Description", description);
     xml.WriteElementString("AppDomain", AppDomainFriendlyName);
     if (source != null)
     {
         xml.WriteElementString("Source", CreateSourceString(source));
     }
     if (trace != null)
     {
         xml.WriteStartElement("ExtendedData");
         xml.WriteAttributeString("xmlns", trace.EventId);
         trace.WriteTo(xml);
         xml.WriteEndElement();
     }
     if (exception != null)
     {
         xml.WriteStartElement("Exception");
         AddExceptionToTraceString(xml, exception);
         xml.WriteEndElement();
     }
     xml.WriteEndElement();
     return xml.ToNavigator();
 }
        static XPathNavigator BuildTraceString(PlainXmlWriter xml,
                                       TraceEventType type,
                                       string code,
                                       string description,
                                       TraceRecord trace,
                                       Exception exception,
                                       object source)
        {
            xml.WriteStartElement(DiagnosticStrings.TraceRecordTag);
            xml.WriteAttributeString(DiagnosticStrings.NamespaceTag, DiagnosticTrace.TraceRecordVersion);
            xml.WriteAttributeString(DiagnosticStrings.SeverityTag, DiagnosticTrace.LookupSeverity(type));

            xml.WriteElementString(DiagnosticStrings.TraceCodeTag, code);
            xml.WriteElementString(DiagnosticStrings.DescriptionTag, description);
            xml.WriteElementString(DiagnosticStrings.AppDomain, DiagnosticTrace.AppDomainFriendlyName);

            if (source != null)
            {
                xml.WriteElementString(DiagnosticStrings.SourceTag, DiagnosticTrace.CreateSourceString(source));
            }

            if (trace != null)
            {
                xml.WriteStartElement(DiagnosticStrings.ExtendedDataTag);
                xml.WriteAttributeString(DiagnosticStrings.NamespaceTag, trace.EventId);

                trace.WriteTo(xml);

                xml.WriteEndElement();
            }

            if (exception != null)
            {
                xml.WriteStartElement(DiagnosticStrings.ExceptionTag);
                DiagnosticTrace.AddExceptionToTraceString(xml, exception);
                xml.WriteEndElement();
            }

            xml.WriteEndElement();

            return xml.ToNavigator();
        }