<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.3" />

Logger<T>

public class Logger<T> : ILogger<T>, ILogger
Delegates to a new ILogger instance using the full name of the given type, created by the provided ILoggerFactory.
using Microsoft.Extensions.Internal; using System; using System.Diagnostics; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.Logging { [DebuggerDisplay("{DebuggerToString(),nq}")] public class Logger<[System.Runtime.CompilerServices.Nullable(2)] T> : ILogger<T>, ILogger { [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] private readonly ILogger _logger; [System.Runtime.CompilerServices.NullableContext(1)] public Logger(ILoggerFactory factory) { System.ThrowHelper.ThrowIfNull(factory, "factory"); _logger = factory.CreateLogger(GetCategoryName()); } IDisposable ILogger.BeginScope<TState>(TState state) { return this._logger.BeginScope<TState>(state); } bool ILogger.IsEnabled(LogLevel logLevel) { return _logger.IsEnabled(logLevel); } void ILogger.Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) { this._logger.Log<TState>(logLevel, eventId, state, exception, formatter); } private static string GetCategoryName() { return TypeNameHelper.GetTypeDisplayName(typeof(T), true, false, false, '.'); } [System.Runtime.CompilerServices.NullableContext(1)] internal string DebuggerToString() { return DebuggerDisplayFormatting.DebuggerToString(GetCategoryName(), this); } } }