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