2 // System.Diagnostics.Debug.cs
5 // Jonathan Pryor (jonpryor@vt.edu)
7 // Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
8 // can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using System.Diagnostics;
37 namespace System.Diagnostics {
39 public sealed class Debug {
43 public static bool AutoFlush {
44 get {return TraceImpl.AutoFlush;}
45 set {TraceImpl.AutoFlush = value;}
48 public static int IndentLevel {
49 get {return TraceImpl.IndentLevel;}
50 set {TraceImpl.IndentLevel = value;}
53 public static int IndentSize {
54 get {return TraceImpl.IndentSize;}
55 set {TraceImpl.IndentSize = value;}
58 public static TraceListenerCollection Listeners {
59 get {return TraceImpl.Listeners;}
62 [Conditional("DEBUG")]
63 public static void Assert (bool condition)
65 TraceImpl.Assert (condition);
68 [Conditional("DEBUG")]
69 public static void Assert (bool condition, string message)
71 TraceImpl.Assert (condition, message);
74 [Conditional("DEBUG")]
75 public static void Assert (bool condition, string message,
78 TraceImpl.Assert (condition, message, detailMessage);
81 [Conditional("DEBUG")]
82 public static void Close ()
87 [Conditional("DEBUG")]
88 public static void Fail (string message)
90 TraceImpl.Fail (message);
93 [Conditional("DEBUG")]
94 public static void Fail (string message, string detailMessage)
96 TraceImpl.Fail (message, detailMessage);
99 [Conditional("DEBUG")]
100 public static void Flush ()
105 [Conditional("DEBUG")]
106 public static void Indent ()
111 [Conditional("DEBUG")]
112 public static void Unindent ()
114 TraceImpl.Unindent ();
117 [Conditional("DEBUG")]
118 public static void Write (object value)
120 TraceImpl.Write (value);
123 [Conditional("DEBUG")]
124 public static void Write (string message)
126 TraceImpl.Write (message);
129 [Conditional("DEBUG")]
130 public static void Write (object value, string category)
132 TraceImpl.Write (value, category);
135 [Conditional("DEBUG")]
136 public static void Write (string message, string category)
138 TraceImpl.Write (message, category);
141 [Conditional("DEBUG")]
142 public static void WriteIf (bool condition, object value)
144 TraceImpl.WriteIf (condition, value);
147 [Conditional("DEBUG")]
148 public static void WriteIf (bool condition, string message)
150 TraceImpl.WriteIf (condition, message);
153 [Conditional("DEBUG")]
154 public static void WriteIf (bool condition, object value,
157 TraceImpl.WriteIf (condition, value, category);
160 [Conditional("DEBUG")]
161 public static void WriteIf (bool condition, string message,
164 TraceImpl.WriteIf (condition, message, category);
167 [Conditional("DEBUG")]
168 public static void WriteLine (object value)
170 TraceImpl.WriteLine (value);
173 [Conditional("DEBUG")]
174 public static void WriteLine (string message)
176 TraceImpl.WriteLine (message);
179 [Conditional("DEBUG")]
180 public static void WriteLine (object value, string category)
182 TraceImpl.WriteLine (value, category);
185 [Conditional("DEBUG")]
186 public static void WriteLine (string message, string category)
188 TraceImpl.WriteLine (message, category);
191 [Conditional("DEBUG")]
192 public static void WriteLineIf (bool condition, object value)
194 TraceImpl.WriteLineIf (condition, value);
197 [Conditional("DEBUG")]
198 public static void WriteLineIf (bool condition, string message)
200 TraceImpl.WriteLineIf (condition, message);
203 [Conditional("DEBUG")]
204 public static void WriteLineIf (bool condition, object value,
207 TraceImpl.WriteLineIf (condition, value, category);
210 [Conditional("DEBUG")]
211 public static void WriteLineIf (bool condition, string message,
214 TraceImpl.WriteLineIf (condition, message, category);
218 [Conditional("DEBUG")]
219 public static void Print (string message)
221 TraceImpl.WriteLine (message);
224 [Conditional("DEBUG")]
225 public static void Print (string format, params Object[] args)
227 TraceImpl.WriteLine (String.Format (format, args));