<Type Name="DefaultTraceListener" FullName="System.Diagnostics.DefaultTraceListener">
  <TypeSignature Language="C#" Maintainer="auto" Value="public class DefaultTraceListener : System.Diagnostics.TraceListener" />
  <AssemblyInfo>
    <AssemblyName>System</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
    <AssemblyVersion>1.0.3300.0</AssemblyVersion>
    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement>
  <Base>
    <BaseTypeName>System.Diagnostics.TraceListener</BaseTypeName>
  </Base>
  <Interfaces>
  </Interfaces>
  <Docs>
    <summary>The DefaultTraceListener is a <see cref="T:System.Diagnostics.TraceListener" /> that is, by default, present in all applications.</summary>
    <remarks>
      <para>The DefaultTraceListener is a <see cref="T:System.Diagnostics.TraceListener" /> that is present (by default) in all applications.  All messages sent through <see cref="M:System.Diagnostics.Trace.Write" /> (and related methods) will be sent to the DefaultTraceListener, as well as any other TraceListeners in the <see cref="P:System.Diagnostics.Trace.Listeners" /> collection.</para>
      <para>There are three ways to view the output of the DefaultTraceListener:</para>
      <list type="number">
        <item>
          <term>
            <para>Set the <see cref="P:System.Diagnostics.DefaultTraceListener.LogFileName" /> property.  This will cause all output to be appended to the specified log file.</para>
            <para>This is the only behavior that is consistent across both .NET and Mono platforms.</para>
            <para>The LogFileName property can be set either through code, or in the application .config file, by setting the (XPath) <c>/configuration/system.diagnostics/assert/@logfilename</c> attribute.   For example:</para>
            <example>
              <code lang=".config file">&lt;configuration&gt;
  &lt;system.diagnostics&gt;
    &lt;assert logfilename="where I want TraceListener messages to go"/&gt;
  &lt;/system.diagnostics&gt;
&lt;/configuration&gt;</code>
            </example>
          </term>
        </item>
        <item>
          <term>On Windows, messages are also displayed using the <c>OutputDebugString</c> API.  (Look it up on MSDN.)  Messages are automatically displayed in the debugger if the program is being debugged.  If the program isn't being debugged, a program such as <c>DebugView</c>, available from <c>http://www.sysinternals.com</c> can be used to view the output.</term>
        </item>
        <item>
          <term>
            <para>On Unix, the LogFileName property is used, with additional behavior available depending on the <c>MONO_TRACE_LISTENER</c> environment variable.</para>
            <para>If <c>MONO_TRACE_LISTENER</c> isn't set or is empty, messages are ignored.</para>
            <para>Otherwise, the value in <c>MONO_TRACE_LISTENER</c> must match the following BNF-like grammar:</para>
            <para>
              <code lang="MONO_TRACE_LISTENER BNF Grammar">MONO_TRACE_LISTENER := &lt;builtin-locations/&gt; | &lt;file-name/&gt;

&lt;builtin-locations/&gt; := ( "Console.Out" | "Console.Error" ) ( ':' &lt;prefix/&gt; )?

&lt;prefix/&gt; := any string of characters

&lt;file-name/&gt; := any valid file name</code>
            </para>
            <para>
              <c>Console.Out</c> corresponds to Standard Output (<c>/dev/stdout</c>), and <c>Console.Error</c> corresponds to Standard Error (<c>/dev/stderr</c>).  This also means that you cannot create a filename of Console.Out or Console.Error.</para>
            <para>The "prefix" is a string of characters that appears before each message printed to Standard Output or Standard Error.  It is not available for filename settings.  It is present so that it is easier to distinguish between normal program output and the diagnostic messages.</para>
            <para>For example, given the following sample program:</para>
            <example>
              <code lang="C#">using System;
using System.Diagnostics;
public class ShowDefaultTraceListener {
	public static void Main ()
	{
		Console.WriteLine ("Standard Output message.");
		Trace.WriteLine ("TraceListener message");
	}
}</code>
            </example>
            <para>If <c>MONO_TRACE_LISTENER</c> is set to "<c>Console.Out:++prefix++ </c>", then the output of the program under Unix would be:</para>
            <example>
              <code lang="Output">Standard Output message.
++prefix++ TraceListener message</code>
            </example>
          </term>
        </item>
      </list>
      <para>The DefaultTraceListener is not complete.  MSDN specifies that GUI widgets be used for certain features, such as when <see cref="P:System.Diagnostics.TraceListener.AssertUiEnabled" /> is <see langword="true" /> and <see cref="M:System.Diagnostics.TraceListener.Fail" /> is called.  GUI support is not present, so non-GUI alternatives should be used, such as LogFileName.</para>
      <para>The default <see cref="P:System.Diagnostics.TraceListener.Name" /> is "<c>Default</c>".  The name can be used to remove TraceListeners.</para>
      <para>See <see cref="T:System.Diagnostics.TraceListener" /> for more information on adding and removing TraceListeners.</para>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public DefaultTraceListener ();" />
      <MemberType>Constructor</MemberType>
      <ReturnValue />
      <Parameters />
      <Docs>
        <summary>Constructs a new instance of the <see cref="T:System.Diagnostics.DefaultTraceListener" /> class.</summary>
        <remarks>Constructs a new instance of the <see cref="T:System.Diagnostics.DefaultTraceListener" /> class, with a <see cref="P:System.Diagnostics.TraceListener.Name" /> value of <c>Default</c>.</remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="AssertUiEnabled">
      <MemberSignature Language="C#" Value="public bool AssertUiEnabled { set; get; }" />
      <MemberType>Property</MemberType>
      <ReturnValue>
        <ReturnType>System.Boolean</ReturnType>
      </ReturnValue>
      <Parameters>
      </Parameters>
      <Docs>
        <summary>Gets or sets whether a GUI is used for some functionality.  This is ignored by Mono.</summary>
        <value>Whether or not a GUI should be used when <see cref="M:System.Diagnostics.TraceListener.Fail" /> is called.</value>
        <remarks>
          <para>If <see langword="true" />, calls to <see cref="M:System.Diagnostics.TraceListener.Fail" /> should appear in a GUI dialog box.</para>
          <para>This is currently ignored by Mono.</para>
        </remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="Fail">
      <MemberSignature Language="C#" Value="public override void Fail (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="message">The failure message to display.</param>
        <summary>Writes a failure message.</summary>
        <remarks>
          <para>Writes a failure message, which is a message that should be displayed in a very visible fashion.  If <see cref="P:System.Diagnostics.DefaultTraceListener.AssertUiEnabled" /> is <see langword="true" />, the message is displayed in a GUI dialog box, interupting whatever the user might be doing.</para>
        </remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="Fail">
      <MemberSignature Language="C#" Value="public override void Fail (string message, string detailMessage);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
        <Parameter Name="detailMessage" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="message">The short message to display.</param>
        <param name="detailMessage">The detailed message to display.</param>
        <summary>Writes a failure message with detailed information.</summary>
        <remarks>
          <para>Writes a failure message, which is a message that should be displayed in a very visible fashion, along with detailed information.  If <see cref="P:System.Diagnostics.DefaultTraceListener.AssertUiEnabled" /> is <see langword="true" />, the message is displayed in a GUI dialog box, interupting whatever the user might be doing.</para>
        </remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="LogFileName">
      <MemberSignature Language="C#" Value="public string LogFileName { set; get; }" />
      <MemberType>Property</MemberType>
      <ReturnValue>
        <ReturnType>System.String</ReturnType>
      </ReturnValue>
      <Parameters>
      </Parameters>
      <Docs>
        <summary>Gets or sets the name of a log file to write trace and debug messages to.</summary>
        <value>To be added: an object of type 'string'</value>
        <remarks>When set to a non-empty string, all debug and trace messages are appended to the specified file.</remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="Write">
      <MemberSignature Language="C#" Value="public override void Write (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="message">The message to display.</param>
        <summary>Writes <paramref name="message" />.</summary>
        <remarks>
          <para>Writes <paramref name="message" /> to a number of potential locations.</para>
          <para>See <see cref="T:System.Diagnostics.DefaultTraceListener" /> for location information.</para>
        </remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
    <Member MemberName="WriteLine">
      <MemberSignature Language="C#" Value="public override void WriteLine (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <param name="message">The message to display.</param>
        <summary>Writes <paramref name="message" />, followed by <see cref="P:System.Environment.NewLine" />.</summary>
        <remarks>
          <para>Writes <paramref name="message" />, followed by <see cref="P:System.Environment.NewLine" />, to a number of potential locations.</para>
          <para>See <see cref="T:System.Diagnostics.DefaultTraceListener" /> for location information.</para>
        </remarks>
      </Docs>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
      </AssemblyInfo>
    </Member>
  </Members>
</Type>
