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
'Declaration
Public Interface ITraceableComponent
'Usage
Dim instance As ITraceableComponent
public interface ITraceableComponent
public interface class ITraceableComponent
type ITraceableComponent = interface end
public interface ITraceableComponent
The ITraceableComponent type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() |
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.
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
}
Public Class CustomExtension
Implements ITraceableComponent
Public Sub processSomething()
Try
'Do something
Catch e As Exception
If m_log IsNot Nothing AndAlso m_log.TraceError Then
m_log.WriteTrace("CustomExtension:" & vbCr & vbLf & "An exception has occurred!", System.Diagnostics.TraceLevel.[Error])
End If
End Try
End Sub
#Region "ITraceableComponent Members"
Public Sub SetTraceLog(ByVal traceLog As ITraceLog)
m_log = traceLog
End Sub
#End Region
#Region "Member variables"
Private m_log As ITraceLog
#End Region
End Class