2024-04-29 23:55:36 +08:00
|
|
|
|
using Canon.Core.Abstractions;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
2024-04-28 22:02:29 +08:00
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
|
|
|
|
|
|
namespace Canon.Tests.Utils;
|
|
|
|
|
|
2024-04-29 23:55:36 +08:00
|
|
|
|
public class TestLogger(ITestOutputHelper testOutputHelper) : ICompilerLogger
|
2024-04-28 22:02:29 +08:00
|
|
|
|
{
|
|
|
|
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception,
|
|
|
|
|
Func<TState, Exception?, string> formatter)
|
|
|
|
|
{
|
2024-04-29 23:55:36 +08:00
|
|
|
|
testOutputHelper.WriteLine($"{logLevel}: {formatter(state, exception)}");
|
2024-04-28 22:02:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-29 23:55:36 +08:00
|
|
|
|
public string Build() => string.Empty;
|
2024-04-28 22:02:29 +08:00
|
|
|
|
}
|