ITraceableComponent Interface

Represents a custom Reporting Services extension that can write trace messages to the report server trace log. 

Namespace:  Microsoft.ReportingServices.Extensions
Assembly:  Microsoft.ReportingServices.Diagnostics (in Microsoft.ReportingServices.Diagnostics.dll)

Syntax

C#
public interface ITraceableComponent

The ITraceableComponent type exposes the following members.

Methods

  Name Description
Public method SetTraceLog Sets the handle to an ITraceLog object. The custom extension can use the ITraceLog object to write messages to the report server trace log.

Top

Examples

The following sample class demonstrates how to implement the ITraceableComponent interface to log an error message in the report server trace log.

C#
public class CustomExtension : ITraceableComponent
{
   public void processSomething()
   {
      try
      {
         //Do something
      }
      catch(Exception e)
      {
         if (m_log != null && m_log.TraceError)
         {
            m_log.WriteTrace("CustomExtension:\r\n" + "An exception has occurred!", System.Diagnostics.TraceLevel.Error);
         }
      }
   }

   #region ITraceableComponent Members

   public void SetTraceLog(ITraceLog traceLog)
   {
      m_log = traceLog;
   }

   #endregion

   #region Member variables
   private ITraceLog m_log;
   #endregion
}