vknet_vk/VkNet/Infrastructure/NullLogger.cs
Инютин Максим Николаевич 2d08df5520 Добавляет заглушку для логгера
2023-09-12 00:47:11 +03:00

29 lines
No EOL
785 B
C#

using System;
using Microsoft.Extensions.Logging;
namespace VkNet.Infrastructure;
/// <summary>
/// Minimalistic logger that does nothing.
/// </summary>
public class NullLogger : ILogger
{
/// <summary>
/// Returns an instance of <see cref="NullLogger" />.
/// </summary>
/// <returns> An instance of <see cref="NullLogger" />. </returns>
public static readonly NullLogger Instance = new();
/// <inheritdoc />
public IDisposable BeginScope<TState>(TState state)
where TState : notnull => NullScope.Instance;
/// <inheritdoc />
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, System.Exception exception,
Func<TState, System.Exception, string> formatter)
{
}
/// <inheritdoc />
public bool IsEnabled(LogLevel logLevel) => false;
}