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 static class Debug {
41 public static bool AutoFlush {
42 get {return TraceImpl.AutoFlush;}
43 set {TraceImpl.AutoFlush = value;}
46 public static int IndentLevel {
47 get {return TraceImpl.IndentLevel;}
48 set {TraceImpl.IndentLevel = value;}
51 public static int IndentSize {
52 get {return TraceImpl.IndentSize;}
53 set {TraceImpl.IndentSize = value;}
56 public static TraceListenerCollection Listeners {
57 get {return TraceImpl.Listeners;}
60 [Conditional("DEBUG")]
61 public static void Assert (bool condition)
63 TraceImpl.Assert (condition);
66 [Conditional("DEBUG")]
67 public static void Assert (bool condition, string message)
69 TraceImpl.Assert (condition, message);
72 [Conditional("DEBUG")]
73 public static void Assert (bool condition, string message,
76 TraceImpl.Assert (condition, message, detailMessage);
80 [Conditional ("DEBUG")]
81 public static void Assert (bool condition, string message,
82 string detailMessageFormat, params object [] args)
84 TraceImpl.Assert (condition,
86 string.Format (detailMessageFormat, args));
90 [Conditional("DEBUG")]
91 public static void Close ()
96 [Conditional("DEBUG")]
97 public static void Fail (string message)
99 TraceImpl.Fail (message);
102 [Conditional("DEBUG")]
103 public static void Fail (string message, string detailMessage)
105 TraceImpl.Fail (message, detailMessage);
108 [Conditional("DEBUG")]
109 public static void Flush ()
114 [Conditional("DEBUG")]
115 public static void Indent ()
120 [Conditional("DEBUG")]
121 public static void Unindent ()
123 TraceImpl.Unindent ();
126 [Conditional("DEBUG")]
127 public static void Write (object value)
129 TraceImpl.Write (value);
132 [Conditional("DEBUG")]
133 public static void Write (string message)
135 TraceImpl.Write (message);
138 [Conditional("DEBUG")]
139 public static void Write (object value, string category)
141 TraceImpl.Write (value, category);
144 [Conditional("DEBUG")]
145 public static void Write (string message, string category)
147 TraceImpl.Write (message, category);
150 [Conditional("DEBUG")]
151 public static void WriteIf (bool condition, object value)
153 TraceImpl.WriteIf (condition, value);
156 [Conditional("DEBUG")]
157 public static void WriteIf (bool condition, string message)
159 TraceImpl.WriteIf (condition, message);
162 [Conditional("DEBUG")]
163 public static void WriteIf (bool condition, object value,
166 TraceImpl.WriteIf (condition, value, category);
169 [Conditional("DEBUG")]
170 public static void WriteIf (bool condition, string message,
173 TraceImpl.WriteIf (condition, message, category);
176 [Conditional("DEBUG")]
177 public static void WriteLine (object value)
179 TraceImpl.WriteLine (value);
182 [Conditional("DEBUG")]
183 public static void WriteLine (string message)
185 TraceImpl.WriteLine (message);
188 #if NET_4_0 || MOBILE
189 [Conditional("DEBUG")]
190 public static void WriteLine (string format, params object [] args)
192 TraceImpl.WriteLine (string.Format (format, args));
196 [Conditional("DEBUG")]
197 public static void WriteLine (object value, string category)
199 TraceImpl.WriteLine (value, category);
202 [Conditional("DEBUG")]
203 public static void WriteLine (string message, string category)
205 TraceImpl.WriteLine (message, category);
208 [Conditional("DEBUG")]
209 public static void WriteLineIf (bool condition, object value)
211 TraceImpl.WriteLineIf (condition, value);
214 [Conditional("DEBUG")]
215 public static void WriteLineIf (bool condition, string message)
217 TraceImpl.WriteLineIf (condition, message);
220 [Conditional("DEBUG")]
221 public static void WriteLineIf (bool condition, object value,
224 TraceImpl.WriteLineIf (condition, value, category);
227 [Conditional("DEBUG")]
228 public static void WriteLineIf (bool condition, string message,
231 TraceImpl.WriteLineIf (condition, message, category);
234 [Conditional("DEBUG")]
235 public static void Print (string message)
237 TraceImpl.WriteLine (message);
240 [Conditional("DEBUG")]
241 public static void Print (string format, params Object[] args)
243 TraceImpl.WriteLine (String.Format (format, args));