TraceSwitch.TraceVerbose 속성

정의

스위치에서 모든 메시지를 허용하는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool TraceVerbose { bool get(); };
public bool TraceVerbose { get; }
member this.TraceVerbose : bool
Public ReadOnly Property TraceVerbose As Boolean

속성 값

Level 속성이 Verbose로 설정되어 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 새 TraceSwitch 를 만들고 스위치를 사용하여 오류 메시지를 내보날지 여부를 결정합니다. 스위치는 클래스 수준에서 생성 됩니다. MyMethod속성이 로 설정된 TraceLevel.Verbose경우 Level 두 오류 메시지를 모두 씁니다.

   // Class-level declaration.
   /* Create a TraceSwitch to use in the entire application.*/
private:
   static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" );

public:
   static void MyMethod()
   {
      // Write the message if the TraceSwitch level is set to Error or higher.
      if ( mySwitch->TraceError )
         Console::WriteLine( "My error message." );
      
      // Write the message if the TraceSwitch level is set to Verbose.
      if ( mySwitch->TraceVerbose )
         Console::WriteLine( "My second error message." );
   }

   static void main()
   {
      // Run the method that prints error messages based on the switch level.
      MyMethod();
   }
//Class-level declaration.
/* Create a TraceSwitch to use in the entire application.*/
static TraceSwitch mySwitch = new TraceSwitch("General", "Entire Application");

static public void MyMethod()
{
    // Write the message if the TraceSwitch level is set to Error or higher.
    if (mySwitch.TraceError)
        Console.WriteLine("My error message.");

    // Write the message if the TraceSwitch level is set to Verbose.
    if (mySwitch.TraceVerbose)
        Console.WriteLine("My second error message.");
}

public static void Main(string[] args)
{
    // Run the method that prints error messages based on the switch level.
    MyMethod();
}
' Class-level declaration.
' Create a TraceSwitch to use in the entire application. 
Private Shared mySwitch As New TraceSwitch("General", "Entire Application")    

Public Shared Sub MyMethod()
    ' Write the message if the TraceSwitch level is set to Error or higher.
    If mySwitch.TraceError Then
        Console.WriteLine("My error message.")
    End If 
    ' Write the message if the TraceSwitch level is set to Verbose.
    If mySwitch.TraceVerbose Then
        Console.WriteLine("My second error message.")
    End If
End Sub

Public Shared Sub Main()
    ' Run the method that prints error messages based on the switch level.
    MyMethod()
End Sub

설명

, , TraceInfoTraceWarning및 속성을 및 Trace 클래스와 TraceVerbose 함께 Debug 사용하여 TraceError지정된 중요도 이상의 모든 메시지를 내보낼 수 있습니다. 속성이 로 Level 설정 TraceLevel.Verbose되면 모든 디버깅 및 추적 메시지가 전송됩니다.

적용 대상

추가 정보