Table of Contents

Class InternalTrace

Namespace
NUnit.Framework.Internal
Assembly
nunit.framework.dll

InternalTrace provides facilities for tracing the execution of the NUnit framework. Tests and classes under test may make use of Console writes, System.Diagnostics.Trace or various loggers and NUnit itself traps and processes each of them. For that reason, a separate internal trace is needed.

Note: InternalTrace uses a global lock to allow multiple threads to write trace messages. This can easily make it a bottleneck so it must be used sparingly. Keep the trace Level as low as possible and only insert InternalTrace writes where they are needed. TODO: add some buffering and a separate writer thread as an option. TODO: figure out a way to turn on trace in specific classes only.

public static class InternalTrace
Inheritance
InternalTrace
Inherited Members

Properties

Initialized

Gets a flag indicating whether the InternalTrace is initialized

public static bool Initialized { get; }

Property Value

bool

Methods

GetLogger(string)

Get a named Logger

public static Logger GetLogger(string name)

Parameters

name string

Returns

Logger

GetLogger(Type)

Get a logger named for a particular Type.

public static Logger GetLogger(Type type)

Parameters

type Type

Returns

Logger

Initialize(TextWriter, InternalTraceLevel)

Initialize the internal trace using a provided TextWriter and level

public static void Initialize(TextWriter writer, InternalTraceLevel level)

Parameters

writer TextWriter

A TextWriter

level InternalTraceLevel

The InternalTraceLevel

Initialize(string, InternalTraceLevel)

Initialize the internal trace facility using the name of the log to be written to and the trace level.

public static void Initialize(string logName, InternalTraceLevel level)

Parameters

logName string

The log name

level InternalTraceLevel

The trace level