2
Vote

Add ability to locate IClogService in code

description

It is necessary to be able to locate the IClogService in code instead of relying configuration or an inflexible fallback. This will also allow users to use an IoC container to construct their IClogService if so desired. I have modified my local version to support this concept:
 
In Log.cs:
 
public static Func<IClogService> CreateClogService = () =>
{
 var clogService = ChannelManagerSingleton.Instance.GetChannel<IClogService>();
 return clogService;
};
 
Then change the try/catch in GetClogService in Log.cs:
 
            try
            {
                return CreateClogService();
            }
            catch (Exception ex)
            {
                // Handle error
            }
 
This allows the user to override the Func in order to provide their own Service Location.

comments