mscorlib(4.0.0.0) API with additions
System.Diagnostics.TraceSwitch Class Reference

Provides a multilevel switch to control tracing and debug output without recompiling your code. More...

Inheritance diagram for System.Diagnostics.TraceSwitch:
[legend]
Collaboration diagram for System.Diagnostics.TraceSwitch:
[legend]

Public Member Functions

 TraceSwitch (string displayName, string description)
 Initializes a new instance of the T:System.Diagnostics.TraceSwitch class, using the specified display name and description. More...
 
 TraceSwitch (string displayName, string description, string defaultSwitchValue)
 Initializes a new instance of the T:System.Diagnostics.TraceSwitch class, using the specified display name, description, and default value for the switch. More...
 

Public Attributes

bool TraceError => Level >= TraceLevel.Error
 Gets a value indicating whether the switch allows error-handling messages. More...
 
bool TraceWarning => Level >= TraceLevel.Warning
 Gets a value indicating whether the switch allows warning messages. More...
 
bool TraceInfo => Level >= TraceLevel.Info
 Gets a value indicating whether the switch allows informational messages. More...
 
bool TraceVerbose => Level == TraceLevel.Verbose
 Gets a value indicating whether the switch allows all messages. More...
 
- Public Attributes inherited from System.Diagnostics.Switch
string DisplayName => displayName
 Gets a name used to identify the switch. More...
 

Protected Member Functions

override void OnSwitchSettingChanged ()
 Updates and corrects the level for this switch. More...
 
override void OnValueChanged ()
 Sets the P:System.Diagnostics.Switch.SwitchSetting property to the integer equivalent of the P:System.Diagnostics.Switch.Value property. More...
 
- Protected Member Functions inherited from System.Diagnostics.Switch
 Switch (string displayName, string description)
 Initializes a new instance of the T:System.Diagnostics.Switch class. More...
 
 Switch (string displayName, string description, string defaultSwitchValue)
 Initializes a new instance of the T:System.Diagnostics.Switch class, specifying the display name, description, and default value for the switch. More...
 
virtual internal string [] GetSupportedAttributes ()
 Gets the custom attributes supported by the switch. More...
 

Properties

TraceLevel Level [get, set]
 Gets or sets the trace level that determines the messages the switch allows. More...
 
- Properties inherited from System.Diagnostics.Switch
StringDictionary Attributes [get]
 Gets the custom switch attributes defined in the application configuration file. More...
 
string Description [get]
 Gets a description of the switch. More...
 
int SwitchSetting [get, set]
 Gets or sets the current setting for this switch. More...
 
string Value [get, set]
 Gets or sets the value of the switch. More...
 

Detailed Description

Provides a multilevel switch to control tracing and debug output without recompiling your code.

Definition at line 8 of file TraceSwitch.cs.

Constructor & Destructor Documentation

◆ TraceSwitch() [1/2]

System.Diagnostics.TraceSwitch.TraceSwitch ( string  displayName,
string  description 
)

Initializes a new instance of the T:System.Diagnostics.TraceSwitch class, using the specified display name and description.

Parameters
displayNameThe name to display on a user interface.
descriptionThe description of the switch.

Definition at line 54 of file TraceSwitch.cs.

◆ TraceSwitch() [2/2]

System.Diagnostics.TraceSwitch.TraceSwitch ( string  displayName,
string  description,
string  defaultSwitchValue 
)

Initializes a new instance of the T:System.Diagnostics.TraceSwitch class, using the specified display name, description, and default value for the switch.

Parameters
displayNameThe name to display on a user interface.
descriptionThe description of the switch.
defaultSwitchValueThe default value of the switch.

Definition at line 63 of file TraceSwitch.cs.

Member Function Documentation

◆ OnSwitchSettingChanged()

override void System.Diagnostics.TraceSwitch.OnSwitchSettingChanged ( )
protectedvirtual

Updates and corrects the level for this switch.

Reimplemented from System.Diagnostics.Switch.

Definition at line 69 of file TraceSwitch.cs.

◆ OnValueChanged()

override void System.Diagnostics.TraceSwitch.OnValueChanged ( )
protectedvirtual

Sets the P:System.Diagnostics.Switch.SwitchSetting property to the integer equivalent of the P:System.Diagnostics.Switch.Value property.

Reimplemented from System.Diagnostics.Switch.

Definition at line 85 of file TraceSwitch.cs.

Member Data Documentation

◆ TraceError

bool System.Diagnostics.TraceSwitch.TraceError => Level >= TraceLevel.Error

Gets a value indicating whether the switch allows error-handling messages.

Returns
true if the P:System.Diagnostics.TraceSwitch.Level property is set to F:System.Diagnostics.TraceLevel.Error, F:System.Diagnostics.TraceLevel.Warning, F:System.Diagnostics.TraceLevel.Info, or F:System.Diagnostics.TraceLevel.Verbose; otherwise, false.

Definition at line 34 of file TraceSwitch.cs.

◆ TraceInfo

bool System.Diagnostics.TraceSwitch.TraceInfo => Level >= TraceLevel.Info

Gets a value indicating whether the switch allows informational messages.

Returns
true if the P:System.Diagnostics.TraceSwitch.Level property is set to F:System.Diagnostics.TraceLevel.Info or F:System.Diagnostics.TraceLevel.Verbose; otherwise, false.

Definition at line 44 of file TraceSwitch.cs.

◆ TraceVerbose

bool System.Diagnostics.TraceSwitch.TraceVerbose => Level == TraceLevel.Verbose

Gets a value indicating whether the switch allows all messages.

Returns
true if the P:System.Diagnostics.TraceSwitch.Level property is set to F:System.Diagnostics.TraceLevel.Verbose; otherwise, false.

Definition at line 49 of file TraceSwitch.cs.

◆ TraceWarning

bool System.Diagnostics.TraceSwitch.TraceWarning => Level >= TraceLevel.Warning

Gets a value indicating whether the switch allows warning messages.

Returns
true if the P:System.Diagnostics.TraceSwitch.Level property is set to F:System.Diagnostics.TraceLevel.Warning, F:System.Diagnostics.TraceLevel.Info, or F:System.Diagnostics.TraceLevel.Verbose; otherwise, false.

Definition at line 39 of file TraceSwitch.cs.

Property Documentation

◆ Level

TraceLevel System.Diagnostics.TraceSwitch.Level
getset

Gets or sets the trace level that determines the messages the switch allows.

Returns
One of the T:System.Diagnostics.TraceLevel values that that specifies the level of messages that are allowed by the switch.
Exceptions
T:System.ArgumentExceptionP:System.Diagnostics.TraceSwitch.Level is set to a value that is not one of the T:System.Diagnostics.TraceLevel values.

Definition at line 15 of file TraceSwitch.cs.


The documentation for this class was generated from the following file: