Browse Source

Add deprecation warning message for injecting ILogger

Mark Monteiro 5 years ago
parent
commit
710767fbf2
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Emby.Server.Implementations/ApplicationHost.cs

+ 6 - 2
Emby.Server.Implementations/ApplicationHost.cs

@@ -570,8 +570,12 @@ namespace Emby.Server.Implementations
 
             serviceCollection.AddSingleton(JsonSerializer);
 
-            // TODO: Support for injecting ILogger should be deprecated in favour of ILogger<T> and this removed
-            serviceCollection.AddSingleton<ILogger>(Logger);
+            // TODO: Remove support for injecting ILogger completely
+            serviceCollection.AddSingleton((provider) =>
+            {
+                Logger.LogWarning("Injecting ILogger directly is deprecated and should be replaced with ILogger<T>");
+                return Logger;
+            });
 
             serviceCollection.AddSingleton(FileSystemManager);
             serviceCollection.AddSingleton<TvdbClientManager>();