SourceFilter.ShouldTrace Method

Determines whether the trace listener should trace the event.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

public override bool ShouldTrace(
	TraceEventCache cache,
	string source,
	TraceEventType eventType,
	int id,
	string formatOrMessage,
	Object[] args,
	Object data1,
	Object[] data
)

Parameters

cache
Type: System.Diagnostics.TraceEventCache

An object that represents the information cache for the trace event.

source
Type: System.String

The name of the source.

eventType
Type: System.Diagnostics.TraceEventType

One of the enumeration values that identifies the event type.

id
Type: System.Int32

A trace identifier number.

formatOrMessage
Type: System.String

The format to use for writing an array of arguments or a message to write.

args
Type: System.Object[]

An array of argument objects.

data1
Type: System.Object

A trace data object.

data
Type: System.Object[]

An array of trace data objects.

Return Value

Type: System.Boolean
true if the trace should be produced; otherwise, false.

ExceptionCondition
ArgumentNullException

source is null.

If the value of the source parameter matches the value of the Source property, the method returns true.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft