namespace Iceshrimp.Frontend.Core.InMemoryLogger; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Configuration; internal static class InMemoryLoggerExtension { public static void AddInMemoryLogger( this ILoggingBuilder builder) { builder.AddConfiguration(); builder.Services.TryAddSingleton(); builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton()); LoggerProviderOptions.RegisterProviderOptions(builder.Services); } public static void AddInMemoryLogger( this ILoggingBuilder builder, Action configure ) { builder.Services.TryAddSingleton(); builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton()); builder.Services.Configure(configure); } }