From 710767fbf2c80491448e3c978eec6b2745c9e4db Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Sat, 4 Apr 2020 21:27:48 -0400 Subject: [PATCH] Add deprecation warning message for injecting ILogger --- Emby.Server.Implementations/ApplicationHost.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 5592d39197..b724dc3201 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/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 and this removed - serviceCollection.AddSingleton(Logger); + // TODO: Remove support for injecting ILogger completely + serviceCollection.AddSingleton((provider) => + { + Logger.LogWarning("Injecting ILogger directly is deprecated and should be replaced with ILogger"); + return Logger; + }); serviceCollection.AddSingleton(FileSystemManager); serviceCollection.AddSingleton();