2 /* Circ.Lib : main library behind Circ
3 * Copyright (C) 2007 LAVAL Jérémie
5 * This file is licensed under the terms of the LGPL.
7 * For the complete licence see the file COPYING.
12 using System
.Diagnostics
;
13 using System
.Reflection
;
22 public static class Logger
31 public static TextWriter Output
{
37 throw new ArgumentNullException("value");
43 private static void Log(LogType type
, string mess
)
45 StackTrace st
= new StackTrace();
46 StackFrame sf
= st
.GetFrame(2);
48 if (mess
== null || sf
== null)
51 sw
.WriteLine(type
.ToString()+" -> "+ sf
.GetMethod().Name
+" :: "+mess
);
54 [System
.Diagnostics
.ConditionalAttribute("__DEBUG__")]
55 public static void Debug(string mess
)
57 Log(LogType
.Debug
, mess
);
60 public static void Error(string mess
, Exception ex
)
62 string message
= (ex
== null) ? mess
: (mess
+ ", Exception type : " + ex
.GetType().ToString()
63 + ", Exception message : " + ex
.Message
);
64 Log(LogType
.Error
, message
);