using Microsoft.Extensions.Logging; namespace Big.Tests; /// A minimal that records the level and rendered message of each /// entry, so tests can assert that (for example) a failing job was logged. internal sealed class CapturingLogger : ILogger { public List<(LogLevel Level, string Message)> Entries { get; } = []; public IDisposable BeginScope(TState state) where TState : notnull => NullScope.Instance; public bool IsEnabled(LogLevel logLevel) => true; public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) => Entries.Add((logLevel, formatter(state, exception))); private sealed class NullScope : IDisposable { public static readonly NullScope Instance = new(); public void Dispose() { } } }