Main Class to configure trace output devices. The default instance is basically a null device.
Inheritance: IDisposable
Example #1
0
 /// <summary>
 ///     Re/Set trace configuration in a thread safe way by shutting down the already existing listeners and then
 ///     put the new config into place.
 /// </summary>
 /// <param name="cfg">
 ///     The trace string format is of the form OutputDevice;TypeFilter MessageFilter; TypeFilter
 ///     MessageFilter; ...
 /// </param>
 /// <param name="bClearEvents">if true all registered trace callbacks are removed.</param>
 /// <returns>The old trace configuration string.</returns>
 public static string Reset(string cfg, bool bClearEvents)
 {
     lock (myLock)
     {
         Instance.Dispose();
         var old = Environment.GetEnvironmentVariable(TraceEnvVarName);
         Environment.SetEnvironmentVariable(TraceEnvVarName, cfg);
         Instance = new TracerConfig(Environment.GetEnvironmentVariable(TraceEnvVarName));
         if (bClearEvents)
         {
             Tracer.ClearEvents();
         }
         return(old);
     }
 }
 /// <summary>
 ///     Re/Set trace configuration in a thread safe way by shutting down the already existing listeners and then
 ///     put the new config into place.
 /// </summary>
 /// <param name="cfg">
 ///     The trace string format is of the form OutputDevice;TypeFilter MessageFilter; TypeFilter
 ///     MessageFilter; ...
 /// </param>
 /// <param name="bClearEvents">if true all registered trace callbacks are removed.</param>
 /// <returns>The old trace configuration string.</returns>
 public static string Reset(string cfg, bool bClearEvents)
 {
     lock (myLock)
     {
         Instance.Dispose();
         var old = Environment.GetEnvironmentVariable(TraceEnvVarName);
         Environment.SetEnvironmentVariable(TraceEnvVarName, cfg);
         Instance = new TracerConfig(Environment.GetEnvironmentVariable(TraceEnvVarName));
         if (bClearEvents)
         {
             Tracer.ClearEvents();
         }
         return old;
     }
 }