Added hammock project to debug streaming issues
[pithos-ms-client] / trunk / hammock / src / net35 / Hammock.Silverlight / Compat / Trace.cs
1 using System;
2 using System.Diagnostics;
3 using System.Text;
4
5 namespace Hammock.Silverlight.Compat
6 {
7     public class Trace
8     {
9         public static bool Enabled { get; set; }
10
11         static Trace()
12         {
13             Enabled = true;
14         }
15
16         public static void WriteLine(string message)
17         {
18             if (!Enabled)
19             {
20                 return;
21             }
22
23             Debug.WriteLine(message);
24         }
25
26         public static void WriteLineIf(bool condition, string message)
27         {
28             if (!Enabled)
29             {
30                 return;
31             }
32
33             if(condition)
34             {
35                 Debug.WriteLine(message);
36             }
37         }
38
39         public static void WriteLine(string message, params object[] args)
40         {
41             if (!Enabled)
42             {
43                 return;
44             }
45
46             Debug.WriteLine(message, args);
47         }
48
49         public static void WriteLine(StringBuilder sb)
50         {
51             if (!Enabled)
52             {
53                 return;
54             }
55
56             Debug.WriteLine(sb.ToString());
57         }
58     }
59 }
60
61