ITraceableComponent Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a custom Reporting Services extension that can write trace messages to the report server trace log.
public interface class ITraceableComponent
public interface ITraceableComponent
type ITraceableComponent = interface
Public Interface ITraceableComponent
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
Methods
SetTraceLog(ITraceLog) |
Sets the handle to an ITraceLog object. The custom extension can use the ITraceLog object to write messages to the report server trace log. |