System.Diagnostics.XmlWriterTraceListener.WriteFooter C# (CSharp) Method

WriteFooter() private method

private WriteFooter ( TraceEventCache eventCache ) : void
eventCache TraceEventCache
return void
        private void WriteFooter(TraceEventCache eventCache) {
            bool writeLogicalOps = IsEnabled(TraceOptions.LogicalOperationStack);
            bool writeCallstack = IsEnabled(TraceOptions.Callstack);
            
            if (eventCache != null && (writeLogicalOps || writeCallstack)) {
                InternalWrite("<System.Diagnostics xmlns=\"http://schemas.microsoft.com/2004/08/System.Diagnostics\">");
            
                if (writeLogicalOps) {
                    InternalWrite("<LogicalOperationStack>");
                    
                    Stack s = eventCache.LogicalOperationStack as Stack;

                    if (s != null) {
                        foreach (object correlationId in s) {
                            InternalWrite("<LogicalOperation>");
                            WriteEscaped(correlationId.ToString());
                            InternalWrite("</LogicalOperation>");
                        }
                    }
                    InternalWrite("</LogicalOperationStack>");
                }

                InternalWrite("<Timestamp>");
                InternalWrite(eventCache.Timestamp.ToString(CultureInfo.InvariantCulture));
                InternalWrite("</Timestamp>");

                if (writeCallstack) {
                    InternalWrite("<Callstack>");
                    WriteEscaped(eventCache.Callstack);
                    InternalWrite("</Callstack>");
                }

                InternalWrite("</System.Diagnostics>");
            }

            InternalWrite("</ApplicationData></E2ETraceEvent>");
        }