2
2
//
3
3
// Licensed under the MIT license.
4
4
5
- using log4net ;
6
- using log4net . Core ;
7
5
using System ;
8
6
using System . Collections . Generic ;
9
7
using System . Diagnostics ;
@@ -108,7 +106,7 @@ public void E2ETest(string testCase)
108
106
var converterSettings = new ProjectConverterSettings ( )
109
107
{
110
108
Include = ConverterInclude ,
111
- Log = new TestLog ( TestOutputHelper ) ,
109
+ Log = new XUnitLogger ( TestOutputHelper ) ,
112
110
RepositoryRoot = workingDir ,
113
111
} ;
114
112
var converter = new ProjectConverter ( converterSettings ) ;
@@ -121,109 +119,5 @@ public void E2ETest(string testCase)
121
119
string actualProjectContent = File . ReadAllText ( Path . Combine ( workingDir , BeforeProjectName ) ) ;
122
120
Assert . Equal ( expectedProjectContent , actualProjectContent ) ;
123
121
}
124
-
125
- private sealed class TestLog : ILog
126
- {
127
- private const string DebugLevel = "Debug" ;
128
- private const string ErrorLevel = "Error" ;
129
- private const string FatalLevel = "Fatal" ;
130
- private const string InfoLevel = "Info" ;
131
- private const string WarnLevel = "Warn" ;
132
-
133
- private readonly ITestOutputHelper _testOutputHelper ;
134
-
135
- public TestLog ( ITestOutputHelper testOutputHelper )
136
- {
137
- _testOutputHelper = testOutputHelper ;
138
- }
139
-
140
- public bool IsDebugEnabled => true ;
141
-
142
- public bool IsInfoEnabled => true ;
143
-
144
- public bool IsWarnEnabled => true ;
145
-
146
- public bool IsErrorEnabled => true ;
147
-
148
- public bool IsFatalEnabled => true ;
149
-
150
- public ILogger Logger => throw new NotImplementedException ( ) ;
151
-
152
- public void Debug ( object message ) => Log ( DebugLevel , message ) ;
153
-
154
- public void Debug ( object message , Exception exception ) => Log ( DebugLevel , message , exception ) ;
155
-
156
- public void DebugFormat ( string format , params object [ ] args ) => Log ( DebugLevel , format , args ) ;
157
-
158
- public void DebugFormat ( string format , object arg0 ) => Log ( DebugLevel , string . Format ( format , arg0 ) ) ;
159
-
160
- public void DebugFormat ( string format , object arg0 , object arg1 ) => Log ( DebugLevel , string . Format ( format , arg0 , arg1 ) ) ;
161
-
162
- public void DebugFormat ( string format , object arg0 , object arg1 , object arg2 ) => Log ( DebugLevel , string . Format ( format , arg0 , arg2 ) ) ;
163
-
164
- public void DebugFormat ( IFormatProvider provider , string format , params object [ ] args ) => Log ( DebugLevel , string . Format ( provider , format , args ) ) ;
165
-
166
- public void Error ( object message ) => Log ( ErrorLevel , message ) ;
167
-
168
- public void Error ( object message , Exception exception ) => Log ( ErrorLevel , message , exception ) ;
169
-
170
- public void ErrorFormat ( string format , params object [ ] args ) => Log ( ErrorLevel , format , args ) ;
171
-
172
- public void ErrorFormat ( string format , object arg0 ) => Log ( ErrorLevel , string . Format ( format , arg0 ) ) ;
173
-
174
- public void ErrorFormat ( string format , object arg0 , object arg1 ) => Log ( ErrorLevel , string . Format ( format , arg0 , arg1 ) ) ;
175
-
176
- public void ErrorFormat ( string format , object arg0 , object arg1 , object arg2 ) => Log ( ErrorLevel , string . Format ( format , arg0 , arg2 ) ) ;
177
-
178
- public void ErrorFormat ( IFormatProvider provider , string format , params object [ ] args ) => Log ( ErrorLevel , string . Format ( provider , format , args ) ) ;
179
-
180
- public void Fatal ( object message ) => Log ( FatalLevel , message ) ;
181
-
182
- public void Fatal ( object message , Exception exception ) => Log ( FatalLevel , message , exception ) ;
183
-
184
- public void FatalFormat ( string format , params object [ ] args ) => Log ( FatalLevel , format , args ) ;
185
-
186
- public void FatalFormat ( string format , object arg0 ) => Log ( FatalLevel , string . Format ( format , arg0 ) ) ;
187
-
188
- public void FatalFormat ( string format , object arg0 , object arg1 ) => Log ( FatalLevel , string . Format ( format , arg0 , arg1 ) ) ;
189
-
190
- public void FatalFormat ( string format , object arg0 , object arg1 , object arg2 ) => Log ( FatalLevel , string . Format ( format , arg0 , arg2 ) ) ;
191
-
192
- public void FatalFormat ( IFormatProvider provider , string format , params object [ ] args ) => Log ( FatalLevel , string . Format ( provider , format , args ) ) ;
193
-
194
- public void Info ( object message ) => Log ( InfoLevel , message ) ;
195
-
196
- public void Info ( object message , Exception exception ) => Log ( InfoLevel , message , exception ) ;
197
-
198
- public void InfoFormat ( string format , params object [ ] args ) => Log ( InfoLevel , format , args ) ;
199
-
200
- public void InfoFormat ( string format , object arg0 ) => Log ( InfoLevel , string . Format ( format , arg0 ) ) ;
201
-
202
- public void InfoFormat ( string format , object arg0 , object arg1 ) => Log ( InfoLevel , string . Format ( format , arg0 , arg1 ) ) ;
203
-
204
- public void InfoFormat ( string format , object arg0 , object arg1 , object arg2 ) => Log ( InfoLevel , string . Format ( format , arg0 , arg2 ) ) ;
205
-
206
- public void InfoFormat ( IFormatProvider provider , string format , params object [ ] args ) => Log ( InfoLevel , string . Format ( provider , format , args ) ) ;
207
-
208
- public void Warn ( object message ) => Log ( WarnLevel , message ) ;
209
-
210
- public void Warn ( object message , Exception exception ) => Log ( WarnLevel , message , exception ) ;
211
-
212
- public void WarnFormat ( string format , params object [ ] args ) => Log ( WarnLevel , format , args ) ;
213
-
214
- public void WarnFormat ( string format , object arg0 ) => Log ( WarnLevel , string . Format ( format , arg0 ) ) ;
215
-
216
- public void WarnFormat ( string format , object arg0 , object arg1 ) => Log ( WarnLevel , string . Format ( format , arg0 , arg1 ) ) ;
217
-
218
- public void WarnFormat ( string format , object arg0 , object arg1 , object arg2 ) => Log ( WarnLevel , string . Format ( format , arg0 , arg2 ) ) ;
219
-
220
- public void WarnFormat ( IFormatProvider provider , string format , params object [ ] args ) => Log ( WarnLevel , string . Format ( provider , format , args ) ) ;
221
-
222
- private void Log ( string level , object message ) => _testOutputHelper . WriteLine ( $ "[{ level } ] { message } ") ;
223
-
224
- private void Log ( string level , object message , Exception exception ) => _testOutputHelper . WriteLine ( $ "[{ level } ] { message } . Exception: { exception } ") ;
225
-
226
- private void Log ( string level , string format , params object [ ] args ) => _testOutputHelper . WriteLine ( $ "[{ level } ] { format } ", args ) ;
227
- }
228
122
}
229
123
}
0 commit comments