<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0-preview.1.25080.5" />

NullLogger<T>

public class NullLogger<T> : ILogger<T>, ILogger
Minimalistic logger that does nothing.
using System; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.Logging.Abstractions { public class NullLogger<[System.Runtime.CompilerServices.Nullable(2)] T> : ILogger<T>, ILogger { [System.Runtime.CompilerServices.Nullable(1)] public static readonly NullLogger<T> Instance = new NullLogger<T>(); [System.Runtime.CompilerServices.NullableContext(1)] public IDisposable BeginScope<TState>(TState state) { return NullScope.Instance; } [System.Runtime.CompilerServices.NullableContext(2)] public void Log<TState>(LogLevel logLevel, EventId eventId, [System.Runtime.CompilerServices.Nullable(1)] TState state, Exception exception, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 1, 2, 1 })] Func<TState, Exception, string> formatter) { } public bool IsEnabled(LogLevel logLevel) { return false; } } }