##// END OF EJS Templates
Fixed Safe.DisposeCollection NullReferenceException...
Fixed Safe.DisposeCollection NullReferenceException Added logs to ContainerBuilder

File last commit:

r289:95896f882995 v3.0.14 v3
r292:807f0bc35f40 v3
Show More
TraceSourceChannel`1.cs
32 lines | 1.2 KiB | text/x-csharp | CSharpLexer
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() {
var channel = new TraceSourceChannel(typeof(T), typeof(T).FullName);
TraceRegistry.Global.Register(channel);
return channel;
}
}
}