##// END OF EJS Templates
Added test for TraceRegistry
Added test for TraceRegistry

File last commit:

r287:78da52bb28f0 v3
r287:78da52bb28f0 v3
Show More
TraceSourceChannel`1.cs
32 lines | 1.2 KiB | text/x-csharp | CSharpLexer
/ Implab / Diagnostics / TraceSourceChannel`1.cs
cin
Working on Implab.Diagnostics
r286 using System;
using System.Threading;
using TraceSource = System.Diagnostics.TraceSource;
namespace Implab.Diagnostics {
/// <summary>
/// This class is used to provide a single <see cref="TraceSourceChannel"/>
/// instance for the specified class in <typeparamref name="T"/> parameter.
/// </summary>
/// <typeparam name="T">
/// The class for which <see cref="TraceSourceChannel"/> is required.
/// </typeparam>
/// <remarks>
/// The <see cref="TraceSourceChannel"/> instance will be created on demand
/// and automatically registered in <see cref="TraceRegistry.Global"/>.
/// </remarks>
public static class TraceSourceChannel<T> {
static Lazy<TraceSourceChannel> _traceSource = new Lazy<TraceSourceChannel>(CreateChannel, LazyThreadSafetyMode.ExecutionAndPublication);
/// <summary>
/// The default <see cref="TraceSourceChannel"/> instance.
/// </summary>
public static TraceSourceChannel Default { get { return _traceSource.Value; } }
static TraceSourceChannel CreateChannel() {
cin
Added test for TraceRegistry
r287 var channel = new TraceSourceChannel(typeof(T), typeof(T).FullName);
cin
Working on Implab.Diagnostics
r286
TraceRegistry.Global.Register(channel);
return channel;
}
}
}