From fc558d66a90879cdebdd786def1740bf35342895 Mon Sep 17 00:00:00 2001 From: Grover <135006+cdmdotnet@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:46:24 +1300 Subject: [PATCH] Updated the Module to allow for overriding the creation of the logger in-case DI cannot. --- .../Configuration/AzureTableStorageLoggerModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Framework/DependencyInjection/Azure/Cqrs.DependencyInjection.Azure.Storage/Configuration/AzureTableStorageLoggerModule.cs b/Framework/DependencyInjection/Azure/Cqrs.DependencyInjection.Azure.Storage/Configuration/AzureTableStorageLoggerModule.cs index 42eab95a4..3ca357f42 100644 --- a/Framework/DependencyInjection/Azure/Cqrs.DependencyInjection.Azure.Storage/Configuration/AzureTableStorageLoggerModule.cs +++ b/Framework/DependencyInjection/Azure/Cqrs.DependencyInjection.Azure.Storage/Configuration/AzureTableStorageLoggerModule.cs @@ -85,9 +85,19 @@ public virtual void RegisterLoggerComponents(IServiceCollection services) if (isLoggerBound) services.RemoveAll(); - TTableStorageLogger logger = Resolve(services); + TTableStorageLogger logger = InstantiateLogger(services); services.AddSingleton(logger); } + + /// + /// Creates a new instance of the + /// + protected virtual TTableStorageLogger InstantiateLogger(IServiceCollection services) + { + TTableStorageLogger logger = Resolve(services); + + return logger; + } } /// @@ -96,7 +106,6 @@ public virtual void RegisterLoggerComponents(IServiceCollection services) public class AzureTableStorageLoggerModule : AzureTableStorageLoggerModule { - /// /// Instantiate a new instance of the that uses the provided /// to read the following configuration settings: