public FormatLoggerTestFixture()
        {
            var mock = Substitute.For <ILog>();

            mock.When(x => x.Debug(Arg.Any <string>()))
            .Do(c =>
            {
                LogOutput("debug", c);
            });

            mock.When(x => x.Info(Arg.Any <string>()))
            .Do(c =>
            {
                LogOutput("info", c);
            });

            mock.When(x => x.Warn(Arg.Any <string>()))
            .Do(c =>
            {
                LogOutput("warn", c);
            });

            mock.When(x => x.Error(Arg.Any <string>()))
            .Do(c =>
            {
                LogOutput("error", c);
            });

            FormatLoggerAccessor.Initialize(() => mock);

            void LogOutput(string level, CallInfo callInfo)
            {
                TestOutputHelper?.WriteLine($"{level.ToUpper()}: {callInfo.Arg<string>()}");
            }
        }
 static void Main(string[] args)
 {
     JsonConfigAccessor.Initialize();
     FormatLoggerAccessor.Initialize(() => LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType));
     AppDomain.CurrentDomain.UnhandledException += GlobalExceptionHandler;
     HostFactory.Run(x =>
     {
         x.Service <IService>(s =>
         {
             s.ConstructUsing(name => new WindowsService());
             s.WhenStarted(tc => tc.Start());
             s.WhenStopped(tc => tc.Stop());
         });
         x.RunAsLocalSystem();
         x.UseLog4Net("log4net.config");
         x.SetDescription("Project template for Web API OWIN service application.");
         x.SetDisplayName("WebApiOwinBoilerplate service");
         x.SetServiceName("WebApiOwinBoilerplateService");
     });
 }