Rework startup topic handling and reenable output to logging framework (#14243)

This commit is contained in:
JPVenson
2025-06-09 04:52:39 +03:00
committed by GitHub
parent d7faf9a327
commit 1e9e4ffda9
16 changed files with 255 additions and 60 deletions

View File

@@ -98,7 +98,10 @@ namespace Jellyfin.Server.Integration.Tests
.AddEnvironmentVariables("JELLYFIN_")
.AddInMemoryCollection(commandLineOpts.ConvertToConfig());
})
.ConfigureServices(e => e.AddSingleton<IStartupLogger, NullStartupLogger>().AddSingleton(e));
.ConfigureServices(e => e
.AddSingleton<IStartupLogger, NullStartupLogger<object>>()
.AddTransient(typeof(IStartupLogger<>), typeof(NullStartupLogger<>))
.AddSingleton(e));
}
/// <inheritdoc/>
@@ -132,13 +135,20 @@ namespace Jellyfin.Server.Integration.Tests
base.Dispose(disposing);
}
private sealed class NullStartupLogger : IStartupLogger
private sealed class NullStartupLogger<TCategory> : IStartupLogger<TCategory>
{
public StartupLogTopic? Topic => throw new NotImplementedException();
public IStartupLogger BeginGroup(FormattableString logEntry)
{
return this;
}
public IStartupLogger<TCategory1> BeginGroup<TCategory1>(FormattableString logEntry)
{
return new NullStartupLogger<TCategory1>();
}
public IDisposable? BeginScope<TState>(TState state)
where TState : notnull
{
@@ -160,10 +170,25 @@ namespace Jellyfin.Server.Integration.Tests
return this;
}
public IStartupLogger<TCategory1> With<TCategory1>(Microsoft.Extensions.Logging.ILogger logger)
{
return new NullStartupLogger<TCategory1>();
}
IStartupLogger<TCategory> IStartupLogger<TCategory>.BeginGroup(FormattableString logEntry)
{
return new NullStartupLogger<TCategory>();
}
IStartupLogger IStartupLogger.With(Microsoft.Extensions.Logging.ILogger logger)
{
return this;
}
IStartupLogger<TCategory> IStartupLogger<TCategory>.With(Microsoft.Extensions.Logging.ILogger logger)
{
return this;
}
}
}
}