Class Trace Static indentLevel = 0 As Long Static indentSize = 4 As Long ' リスナ管理 Static Listeners As TraceListenerCollection Public '---------------------------------------------------------------- ' パブリック メソッド '---------------------------------------------------------------- ' アサート(コールスタックを表示) Static Sub Assert( condition As Boolean ) If condition == False then 'TODO: コールスタックを表示 End If End Sub ' アサート(メッセージ文字列を表示) Static Sub Assert( condition As Boolean, message As String ) If condition == False then ' TODO: メッセージボックス形式での表示に対応 WriteLine( message ) End If End Sub ' アサート(メッセージ文字列と詳細文字列を表示) Static Sub Assert( condition As Boolean, message As String, detailMessage As String ) If condition == False then ' TODO: メッセージボックス形式での表示に対応 WriteLine( message ) End If End Sub ' インデントレベルを上げる Static Sub Indent() IndentLevel = indentLevel + 1 End Sub ' インデントレベルを下げる Static Sub Unindent() If indentLevel <= 0 Then indentLevel = 0 Return End If IndentLevel = indentLevel - 1 End Sub Static Sub Write( message As String ) End Sub ' 一行の文字列を出力 Static Sub WriteLine( message As String ) Dim i As Long For i = 0 To ELM( Listeners.Count ) Dim temp As TraceListener temp = Listeners[i] temp.WriteLine( message ) Next End Sub '---------------------------------------------------------------- ' パブリック プロパティ '---------------------------------------------------------------- ' IndentLevelプロパティ Static Function IndentLevel() As Long Return indentLevel End Function Static Sub IndentLevel( indentLevel As Long ) This.indentLevel = indentLevel Dim i As Long For i = 0 To ELM( Listeners.Count ) Dim temp As TraceListener temp = Listeners[i] temp.IndentLevel = indentLevel Next End Sub ' IndentSizeプロパティ Static Function IndentSize() As Long Return indentSize End Function Static Sub IndentSize( size As Long ) indentSize = size Dim i As Long For i = 0 To ELM( Listeners.Count ) Dim temp As TraceListener temp = Listeners[i] temp.IndentSize = indentSize Next End Sub End Class Dim _System_defaultTraceListener As DefaultTraceListener Trace.Listeners.Add( _System_defaultTraceListener )