Skip to content

Commit 7efaa6c

Browse files
committed
#262 fixed the issue of 'There is no currently active test.'
1 parent e4c9e59 commit 7efaa6c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Logging/OutputLogger.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@ public bool IsEnabled(LogLevel logLevel)
1818

1919
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception, string> formatter)
2020
{
21-
if (exception is not null)
21+
try
2222
{
23-
_testOutputHelper.WriteLine($"{logLevel} - Category: {_categoryName} : {formatter(state, exception)} :: {DateTime.Now}");
23+
if (exception is not null)
24+
{
25+
_testOutputHelper.WriteLine($"{logLevel} - Category: {_categoryName} : {formatter(state, exception)} :: {DateTime.Now}");
26+
}
27+
else
28+
{
29+
_testOutputHelper.WriteLine($"{logLevel} - Category: {_categoryName} : {state} :: {DateTime.Now}");
30+
}
2431
}
25-
else
32+
catch
2633
{
27-
_testOutputHelper.WriteLine($"{logLevel} - Category: {_categoryName} : {state} :: {DateTime.Now}");
34+
//Ignore
2835
}
2936
}
3037
}

0 commit comments

Comments
 (0)