TraceKeywords Class

Common trace keywords that may be used across teams. Feel free to add keywords that will be useful to all teams. Team-specific feature keywords should be kept in the team's own code area.


Namespace:  Microsoft.TeamFoundation
Assembly:  Microsoft.TeamFoundation.Common (in Microsoft.TeamFoundation.Common.dll)

public class TraceKeywords

The TraceKeywords type exposes the following members.

Public methodTraceKeywords

Public methodStatic memberBuildKeywordBuild a formatted keyword from the keyword fragments. Having all callers build their keywords with this method promotes consistency and ease of tweaking the keyword format.To avoid collisions with other products, this convention may be changed to a new format.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Trace keywords provide a mechanism to compartmentalize the trace messages to functional areas. The keywords are provided as a string array, and can be any string with which the caller wants to tag the trace output.

Each keyword corresponds to a TraceSwitch object, which can be set via the application config file (exe.config, web.config) or at runtime. As an optimization, the TraceSettings class keeps track if any trace switches are enabled and exposes a Boolean (IsTracingEnabled) that can be quickly checked to see whether trace output should be tried.

Each TraceSwitch has a TraceLevel that is one of these values:

  • Off: No output.

  • Error: Errors that occur in your code. For example, you have an exception filter and want to trace the exception.

  • Note: you should be sending information about these to the event log as errors.

  • Warning: Conditions noticed by your application that are problematic but may be transient or self-correcting that should probably be sent to the event log as warnings also.

  • Info: Informative messages, concise and brief.

  • Verbose: Other information; no limits on how much information is provided here.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.