1
// ****************************************************************
2
// Copyright 2008, Charlie Poole
3
// This is free software licensed under the NUnit license. You may
4
// obtain a copy of the license at http://nunit.org.
5
// ****************************************************************
12
/// InternalTraceLevel is an enumeration controlling the
13
/// level of detailed presented in the internal log.
15
public enum InternalTraceLevel
26
/// Summary description for Logger.
28
public class InternalTrace
30
private readonly static string TIME_FMT = "HH:mm:ss.fff";
32
private static bool initialized;
34
private static InternalTraceWriter writer;
35
public static InternalTraceWriter Writer
37
get { return writer; }
40
public static InternalTraceLevel Level;
42
public static void Initialize(string logName)
44
int lev = (int) new System.Diagnostics.TraceSwitch("NTrace", "NUnit internal trace").Level;
45
Initialize(logName, (InternalTraceLevel)lev);
48
public static void Initialize(string logName, InternalTraceLevel level)
54
if (writer == null && Level > InternalTraceLevel.Off)
56
writer = new InternalTraceWriter(logName);
57
writer.WriteLine("InternalTrace: Initializing at level " + Level.ToString());
64
public static void Flush()
70
public static void Close()
78
public static Logger GetLogger(string name)
80
return new Logger( name );
83
public static Logger GetLogger( Type type )
85
return new Logger( type.FullName );
88
public static void Log(InternalTraceLevel level, string message, string category)
90
Log(level, message, category, null);
93
public static void Log(InternalTraceLevel level, string message, string category, Exception ex)
95
Writer.WriteLine("{0} {1,-5} [{2,2}] {3}: {4}",
96
DateTime.Now.ToString(TIME_FMT),
97
level == InternalTraceLevel.Verbose ? "Debug" : level.ToString(),
99
System.Threading.Thread.CurrentThread.ManagedThreadId,
101
AppDomain.GetCurrentThreadId(),
107
Writer.WriteLine(ex.ToString());
1
// ****************************************************************
2
// Copyright 2008, Charlie Poole
3
// This is free software licensed under the NUnit license. You may
4
// obtain a copy of the license at http://nunit.org.
5
// ****************************************************************
12
/// InternalTraceLevel is an enumeration controlling the
13
/// level of detailed presented in the internal log.
15
public enum InternalTraceLevel
26
/// Summary description for Logger.
28
public class InternalTrace
30
private readonly static string TIME_FMT = "HH:mm:ss.fff";
32
private static bool initialized;
34
private static InternalTraceWriter writer;
35
public static InternalTraceWriter Writer
37
get { return writer; }
40
public static InternalTraceLevel Level;
42
public static void Initialize(string logName)
44
int lev = (int) new System.Diagnostics.TraceSwitch("NTrace", "NUnit internal trace").Level;
45
Initialize(logName, (InternalTraceLevel)lev);
48
public static void Initialize(string logName, InternalTraceLevel level)
54
if (writer == null && Level > InternalTraceLevel.Off)
56
writer = new InternalTraceWriter(logName);
57
writer.WriteLine("InternalTrace: Initializing at level " + Level.ToString());
64
public static void Flush()
70
public static void Close()
78
public static Logger GetLogger(string name)
80
return new Logger( name );
83
public static Logger GetLogger( Type type )
85
return new Logger( type.FullName );
88
public static void Log(InternalTraceLevel level, string message, string category)
90
Log(level, message, category, null);
93
public static void Log(InternalTraceLevel level, string message, string category, Exception ex)
95
Writer.WriteLine("{0} {1,-5} [{2,2}] {3}: {4}",
96
DateTime.Now.ToString(TIME_FMT),
97
level == InternalTraceLevel.Verbose ? "Debug" : level.ToString(),
99
System.Threading.Thread.CurrentThread.ManagedThreadId,
101
AppDomain.GetCurrentThreadId(),
107
Writer.WriteLine(ex.ToString());