Changeset 246 for Include/Classes/System/Diagnostics/TraceListener.ab
- Timestamp:
- May 12, 2007, 6:31:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Diagnostics/TraceListener.ab
r147 r246 1 Namespace System 2 Namespace Diagnostics 1 3 2 ' リスナ3 Class TraceListener4 indentLevel As Long5 indentSize As Long4 ' リスナ 5 Class TraceListener 6 indentLevel As Long 7 indentSize As Long 6 8 7 Protected8 Function GetIndentString() As String9 Dim i As Long9 Protected 10 Function GetIndentString() As String 11 Dim i As Long 10 12 11 Dim IndentStr = ""12 For i = 0 To ELM( indentSize )13 IndentStr = IndentStr + " "14 Next13 Dim IndentStr = "" 14 For i = 0 To ELM( indentSize ) 15 IndentStr = IndentStr + " " 16 Next 15 17 16 Dim ResultStr = ""17 For i = 0 To ELM( indentLevel )18 ResultStr = ResultStr + IndentStr19 Next18 Dim ResultStr = "" 19 For i = 0 To ELM( indentLevel ) 20 ResultStr = ResultStr + IndentStr 21 Next 20 22 21 Return ResultStr22 End Function23 Return ResultStr 24 End Function 23 25 24 Public25 Sub TraceListener()26 indentLevel = 027 indentSize = 428 End Sub26 Public 27 Sub TraceListener() 28 indentLevel = 0 29 indentSize = 4 30 End Sub 29 31 30 ' コピーコンストラクタ31 Sub TraceListener( ByRef listener As TraceListener )32 indentLevel = listener.indentLevel33 indentSize = listener.indentSize34 End Sub32 ' コピーコンストラクタ 33 Sub TraceListener( ByRef listener As TraceListener ) 34 indentLevel = listener.indentLevel 35 indentSize = listener.indentSize 36 End Sub 35 37 36 38 37 '----------------------------------------------------------------38 ' パブリック コンストラクタ39 '----------------------------------------------------------------39 '---------------------------------------------------------------- 40 ' パブリック コンストラクタ 41 '---------------------------------------------------------------- 40 42 41 Virtual Sub Write( message As String )42 '派生クラスで実装 (基底では何もしない)43 End Sub44 Virtual Sub Write( value As Object )45 Write( value.ToString() )46 End Sub47 Virtual Sub Write( value As Object, category As String )48 Write( category + ": " + value.ToString() )49 End Sub50 Virtual Sub Write( message As String, category As String )51 Write( category + ": " + message )52 End Sub43 Virtual Sub Write( message As String ) 44 '派生クラスで実装 (基底では何もしない) 45 End Sub 46 Virtual Sub Write( value As Object ) 47 Write( value.ToString() ) 48 End Sub 49 Virtual Sub Write( value As Object, category As String ) 50 Write( category + ": " + value.ToString() ) 51 End Sub 52 Virtual Sub Write( message As String, category As String ) 53 Write( category + ": " + message ) 54 End Sub 53 55 54 Virtual Sub WriteLine( message As String )55 '派生クラスで実装 (基底では何もしない)56 End Sub57 Virtual Sub WriteLine( value As Object )58 WriteLine( value.ToString() )59 End Sub60 Virtual Sub WriteLine( value As Object, category As String )61 WriteLine( category + ": " + value.ToString() )62 End Sub63 Virtual Sub WriteLine( message As String, category As String )64 WriteLine( category + ": " + message )65 End Sub56 Virtual Sub WriteLine( message As String ) 57 '派生クラスで実装 (基底では何もしない) 58 End Sub 59 Virtual Sub WriteLine( value As Object ) 60 WriteLine( value.ToString() ) 61 End Sub 62 Virtual Sub WriteLine( value As Object, category As String ) 63 WriteLine( category + ": " + value.ToString() ) 64 End Sub 65 Virtual Sub WriteLine( message As String, category As String ) 66 WriteLine( category + ": " + message ) 67 End Sub 66 68 67 69 68 '----------------------------------------------------------------69 ' パブリック プロパティ70 '----------------------------------------------------------------70 '---------------------------------------------------------------- 71 ' パブリック プロパティ 72 '---------------------------------------------------------------- 71 73 72 ' IndentLevelプロパティ73 Function IndentLevel() As Long74 Return indentLevel75 End Function76 Sub IndentLevel( indentLevel As Long )77 This.indentLevel = indentLevel78 End Sub74 ' IndentLevelプロパティ 75 Function IndentLevel() As Long 76 Return indentLevel 77 End Function 78 Sub IndentLevel( indentLevel As Long ) 79 This.indentLevel = indentLevel 80 End Sub 79 81 80 ' IndentSizeプロパティ81 Function IndentSize() As Long82 Return indentSize83 End Function84 Sub IndentSize( size As Long )85 indentSize = size86 End Sub87 End Class82 ' IndentSizeプロパティ 83 Function IndentSize() As Long 84 Return indentSize 85 End Function 86 Sub IndentSize( size As Long ) 87 indentSize = size 88 End Sub 89 End Class 88 90 89 ' デフォルトリスナ(デバッガビューへの出力)90 Class DefaultTraceListener91 Inherits TraceListener92 Public91 ' デフォルトリスナ(デバッガビューへの出力) 92 Class DefaultTraceListener 93 Inherits TraceListener 94 Public 93 95 94 Override Sub Write( message As String )95 ' デバッグビューへ出力96 Dim tempStr = GetIndentString() + message97 OutputDebugString( tempStr )96 Override Sub Write( message As String ) 97 ' デバッグビューへ出力 98 Dim tempStr = GetIndentString() + message 99 OutputDebugString( tempStr ) 98 100 99 ' デバッグログへ書き込む100 ' TODO: 実装101 End Sub101 ' デバッグログへ書き込む 102 ' TODO: 実装 103 End Sub 102 104 103 Override Sub WriteLine( message As String ) 104 Write( GetIndentString() + message + Ex"\r\n" ) 105 End Sub 106 End Class 105 Override Sub WriteLine( message As String ) 106 Write( GetIndentString() + message + Ex"\r\n" ) 107 End Sub 108 End Class 109 110 End Namespace 111 End Namespace
Note:
See TracChangeset
for help on using the changeset viewer.