diff options
| author | JPVenson <github@jpb.email> | 2025-06-09 04:52:39 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-08 19:52:39 -0600 |
| commit | 1e9e4ffda9abe30b71ceb1de2f4c3143805c66a9 (patch) | |
| tree | c48fe1dd38a35efe225b1423fbcc295436b87f3b /Jellyfin.Server/Migrations/Stages/CodeMigration.cs | |
| parent | d7faf9a327f506a770afce6709327daf5cc9bc30 (diff) | |
Rework startup topic handling and reenable output to logging framework (#14243)
Diffstat (limited to 'Jellyfin.Server/Migrations/Stages/CodeMigration.cs')
| -rw-r--r-- | Jellyfin.Server/Migrations/Stages/CodeMigration.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Jellyfin.Server/Migrations/Stages/CodeMigration.cs b/Jellyfin.Server/Migrations/Stages/CodeMigration.cs index 47ed26965..c3592f62a 100644 --- a/Jellyfin.Server/Migrations/Stages/CodeMigration.cs +++ b/Jellyfin.Server/Migrations/Stages/CodeMigration.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Jellyfin.Server.ServerSetupApp; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Logging; namespace Jellyfin.Server.Migrations.Stages; @@ -21,11 +22,13 @@ internal class CodeMigration(Type migrationType, JellyfinMigrationAttribute meta return Metadata.Order.ToString("yyyyMMddHHmmsss", CultureInfo.InvariantCulture) + "_" + Metadata.Name!; } - private ServiceCollection MigrationServices(IServiceProvider serviceProvider, IStartupLogger logger) + private IServiceCollection MigrationServices(IServiceProvider serviceProvider, IStartupLogger logger) { - var childServiceCollection = new ServiceCollection(); - childServiceCollection.AddSingleton(serviceProvider); - childServiceCollection.AddSingleton(logger); + var childServiceCollection = new ServiceCollection() + .AddSingleton(serviceProvider) + .AddSingleton(logger) + .AddSingleton(typeof(IStartupLogger<>), typeof(NestedStartupLogger<>)) + .AddSingleton<StartupLogTopic>(logger.Topic!); foreach (ServiceDescriptor service in serviceProvider.GetRequiredService<IServiceCollection>()) { @@ -78,4 +81,11 @@ internal class CodeMigration(Type migrationType, JellyfinMigrationAttribute meta throw new InvalidOperationException($"The type {MigrationType} does not implement either IMigrationRoutine or IAsyncMigrationRoutine and is not a valid migration type"); } } + + private class NestedStartupLogger<TCategory> : StartupLogger<TCategory>, IStartupLogger<TCategory> + { + public NestedStartupLogger(ILogger logger, StartupLogTopic topic) : base(logger, topic) + { + } + } } |
