internal void TraceEvent(TraceEventType type, TraceCode code, string description, TraceRecord trace, Exception exception, object source)
        {
            TraceXPathNavigator traceXPathNavigator = null;

            try
            {
                if (this.TraceSource != null && this.HaveListeners)
                {
                    try
                    {
                        this.BuildTrace(type, code, description, trace, exception, source, out traceXPathNavigator);
                    }
                    catch (PlainXmlWriter.MaxSizeExceededException maxSizeExceededException)
                    {
                        StringTraceRecord stringTraceRecord = new StringTraceRecord("TruncatedTraceId", Microsoft.ServiceBus.Diagnostics.DiagnosticTrace.GenerateTraceCode(code));
                        this.TraceEvent(type, TraceCode.TraceTruncatedQuotaExceeded, Microsoft.ServiceBus.SR.GetString(Resources.TraceCodeTraceTruncatedQuotaExceeded, new object[0]), stringTraceRecord);
                    }
                    this.TraceSource.TraceData(type, (int)code, traceXPathNavigator);
                    if (this.calledShutdown)
                    {
                        this.TraceSource.Flush();
                    }
                    this.LastFailure = DateTime.MinValue;
                }
            }
            catch (Exception exception2)
            {
                Exception exception1 = exception2;
                if (Fx.IsFatal(exception1))
                {
                    throw;
                }
                this.LogTraceFailure((traceXPathNavigator == null ? string.Empty : traceXPathNavigator.ToString()), exception1);
            }
        }
        private void VerifySize(int nodeSize)
        {
            if (this.maxSize != -1 && this.currentSize + (long)nodeSize > (long)this.maxSize)
            {
                throw new PlainXmlWriter.MaxSizeExceededException();
            }
            TraceXPathNavigator traceXPathNavigator = this;

            traceXPathNavigator.currentSize = traceXPathNavigator.currentSize + (long)nodeSize;
        }
 public void RemovePii(string[] headersPath, string[] piiList)
 {
     if (this.root == null)
     {
         throw new ArgumentNullException(SRClient.NullRoot);
     }
     foreach (TraceXPathNavigator.ElementNode elementNode in this.root.FindSubnodes(headersPath))
     {
         TraceXPathNavigator.MaskSubnodes(elementNode, piiList);
     }
 }
 private static void MaskSubnodes(TraceXPathNavigator.ElementNode element, string[] elementNames, bool processNodeItself)
 {
     if (elementNames == null)
     {
         throw new ArgumentNullException("elementNames");
     }
     if (element != null)
     {
         bool flag = true;
         if (processNodeItself)
         {
             string[] strArrays = elementNames;
             int      num       = 0;
             while (num < (int)strArrays.Length)
             {
                 if (string.CompareOrdinal(strArrays[num], element.name) != 0)
                 {
                     num++;
                 }
                 else
                 {
                     TraceXPathNavigator.MaskElement(element);
                     flag = false;
                     break;
                 }
             }
         }
         if (flag && element.childNodes != null)
         {
             foreach (TraceXPathNavigator.ElementNode childNode in element.childNodes)
             {
                 TraceXPathNavigator.MaskSubnodes(childNode, elementNames, true);
             }
         }
     }
 }
示例#5
0
 public PlainXmlWriter(int maxSize)
 {
     this.navigator = new TraceXPathNavigator(maxSize);
 }
        private void BuildTrace(TraceEventType type, TraceCode code, string description, TraceRecord trace, Exception exception, object source, out TraceXPathNavigator navigator)
        {
            PlainXmlWriter plainXmlWriter = new PlainXmlWriter(65535);

            navigator = plainXmlWriter.Navigator;
            this.BuildTrace(plainXmlWriter, type, code, description, trace, exception, source);
            if (!this.TraceSource.ShouldLogPii)
            {
                navigator.RemovePii(Microsoft.ServiceBus.Diagnostics.DiagnosticStrings.HeadersPaths);
            }
        }
 private static void MaskSubnodes(TraceXPathNavigator.ElementNode element, string[] elementNames)
 {
     TraceXPathNavigator.MaskSubnodes(element, elementNames, false);
 }