다음을 통해 공유


SpicIE: Reducing or switching off all diagnostic messages

The SpicIE framework uses the .NET System.Diagnostics.TraceSource class to output a lot of information during the runtime.

During the development and debug process these messages could be really helpful to understand how the plugin works.

But there are situations where you want to reduce or switch totally off these messages.

With the following line of code you can switch off all trace messages from the Host.TraceSink property. If you want to do that, you can put the lines of code if the constructor of your own plug-in.

 #if !DEBUG
            Host.TraceSink.Listeners.Clear();
#endif

If you want to reduce the number of output you can set a TraceSwitch to the Host.TraceSink.SourceSwitch property.

 Host.TraceSink.Switch = new SourceSwitch("ErrorSwitch", "Error");

By doing that you can control what messages will displayed. Following levels you can use to reduce the message output:

  • Error – see only error trace messages
  • Warning – see only error and warning trace messages
  • Information – see only error, warning and information trace messages
  • Verbose – see all.

 

GunnarD