File: DefaultTraceListener.xml

package info (click to toggle)
monodoc 1.1.18-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 58,432 kB
  • ctags: 4,991
  • sloc: xml: 718,392; cs: 38,337; sh: 3,172; perl: 554; makefile: 303
file content (223 lines) | stat: -rwxr-xr-x 12,324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<Type Name="DefaultTraceListener" FullName="System.Diagnostics.DefaultTraceListener">
  <TypeSignature Language="C#" Value="public class DefaultTraceListener : System.Diagnostics.TraceListener, IDisposable" Maintainer="auto" />
  <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>
    <AssemblyCulture>neutral</AssemblyCulture>
    <Attributes>
      <Attribute>
        <AttributeName>System.Resources.NeutralResourcesLanguageAttribute</AttributeName>
      </Attribute>
      <Attribute>
        <AttributeName>System.Resources.SatelliteContractVersionAttribute</AttributeName>
      </Attribute>
      <Attribute>
        <AttributeName>System.CLSCompliantAttribute</AttributeName>
      </Attribute>
      <Attribute>
        <AttributeName>System.Runtime.InteropServices.ComVisibleAttribute</AttributeName>
      </Attribute>
      <Attribute>
        <AttributeName>System.Security.AllowPartiallyTrustedCallersAttribute</AttributeName>
      </Attribute>
    </Attributes>
  </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>
  <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>
  <Base>
    <BaseTypeName>System.Diagnostics.TraceListener</BaseTypeName>
  </Base>
  <Interfaces>
    <Interface>
      <InterfaceName>System.IDisposable</InterfaceName>
    </Interface>
  </Interfaces>
  <Attributes>
    <Attribute>
      <AttributeName>System.Runtime.InteropServices.ComVisibleAttribute</AttributeName>
    </Attribute>
  </Attributes>
  <Members>
    <Member MemberName="WriteLine">
      <MemberSignature Language="C#" Value="public virtual void WriteLine (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <summary>Writes <paramref name="message" />, followed by <see cref="P:System.Environment.NewLine" />.</summary>
        <param name="message">The message to display.</param>
        <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>
    </Member>
    <Member MemberName="Write">
      <MemberSignature Language="C#" Value="public virtual void Write (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <summary>Writes <paramref name="message" />.</summary>
        <param name="message">The message to display.</param>
        <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>
    </Member>
    <Member MemberName="Fail">
      <MemberSignature Language="C#" Value="public virtual 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>
        <summary>Writes a failure message with detailed information.</summary>
        <param name="message">The short message to display.</param>
        <param name="detailMessage">The detailed message to display.</param>
        <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>
    </Member>
    <Member MemberName="Fail">
      <MemberSignature Language="C#" Value="public virtual void Fail (string message);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="message" Type="System.String" />
      </Parameters>
      <Docs>
        <summary>Writes a failure message.</summary>
        <param name="message">The failure message to display.</param>
        <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>
    </Member>
    <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>
        <returns />
        <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>
    </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>
        <param name="value">If <see langword="true" />, calls to <see cref="M:System.Diagnostics.TraceListener.Fail" /> should appear in a GUI dialog box.</param>
        <returns>Whether or not a GUI should be used when <see cref="M:System.Diagnostics.TraceListener.Fail" /> is called.</returns>
        <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>
    </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>
        <param name="value">The name of a log fle to write trace or debug messages to.</param>
        <returns>To be added: an object of type 'string'</returns>
        <remarks>When set to a non-empty string, all debug and trace messages are appended to the specified file.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>