File: Logging\TestLoggerT.cs
Web Access
Project: src\src\Testing\src\Microsoft.AspNetCore.InternalTesting.csproj (Microsoft.AspNetCore.InternalTesting)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using System;
 
namespace Microsoft.Extensions.Logging.Testing;
 
public class TestLogger<T> : ILogger<T>
{
    private readonly ILogger<T> _logger;
 
    public TestLogger(TestLoggerFactory factory)
    {
        _logger = factory.CreateLogger<T>();
    }
 
    public IDisposable BeginScope<TState>(TState state)
    {
        return _logger.BeginScope(state);
    }
 
    public bool IsEnabled(LogLevel logLevel)
    {
        return _logger.IsEnabled(logLevel);
    }
 
    public void Log<TState>(
        LogLevel logLevel,
        EventId eventId,
        TState state,
        Exception exception,
        Func<TState, Exception, string> formatter)
    {
        _logger.Log(logLevel, eventId, state, exception, formatter);
    }
}