Canon/Canon.Tests/Utils/TestLogger.cs
Lan_G 5ca947125b feat-generater (#69)
Reviewed-on: PostGuard/Canon#69
Co-authored-by: Lan_G <2911328695@qq.com>
Co-committed-by: Lan_G <2911328695@qq.com>
2024-04-30 14:43:14 +08:00

25 lines
648 B
C#

using Microsoft.Extensions.Logging;
using Xunit.Abstractions;
namespace Canon.Tests.Utils;
public class TestLogger<T>(ITestOutputHelper testOutputHelper) : ILogger<T>, IDisposable
{
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception,
Func<TState, Exception?, string> formatter)
{
testOutputHelper.WriteLine("{0}: {1}", logLevel, formatter(state, exception));
}
public bool IsEnabled(LogLevel logLevel) => false;
public void Dispose()
{
}
public IDisposable BeginScope<TState>(TState state) where TState : notnull
{
return this;
}
}