replaced owin's ITraceOutputFactory to one based on nlog that should work on linux.

pull/4/head
Keivan Beigi 11 years ago
parent 9b9e1e20eb
commit 6c7e12da5b

@ -26,7 +26,6 @@ namespace NzbDrone.Host
Container.Register(typeof(IBasicRepository<RootFolder>), typeof(BasicRepository<RootFolder>));
Container.Register(typeof(IBasicRepository<NamingConfig>), typeof(BasicRepository<NamingConfig>));
Container.Register(typeof(System.IServiceProvider), typeof(OwinServiceProvider));
Container.Register<INancyBootstrapper, NancyBootstrapper>();
}

@ -14,15 +14,13 @@ namespace NzbDrone.Host.Owin
{
private readonly IConfigFileProvider _configFileProvider;
private readonly IEnumerable<IOwinMiddleWare> _owinMiddleWares;
private readonly IServiceProvider _serviceProvider;
private readonly Logger _logger;
private IDisposable _host;
public OwinHostController(IConfigFileProvider configFileProvider, IEnumerable<IOwinMiddleWare> owinMiddleWares, IServiceProvider serviceProvider, Logger logger)
public OwinHostController(IConfigFileProvider configFileProvider, IEnumerable<IOwinMiddleWare> owinMiddleWares, Logger logger)
{
_configFileProvider = configFileProvider;
_owinMiddleWares = owinMiddleWares;
_serviceProvider = serviceProvider;
_logger = logger;
}
@ -39,7 +37,7 @@ namespace NzbDrone.Host.Owin
_logger.Info("starting server on {0}", url);
_host = WebApp.Start(_serviceProvider, options, BuildApp);
_host = WebApp.Start(OwinServiceProviderFactory.Create(), options, BuildApp);
}
private void BuildApp(IAppBuilder appBuilder)

@ -1,25 +1,16 @@
using System;
using Microsoft.Owin.Hosting.Services;
using Microsoft.Owin.Hosting.Services;
using Microsoft.Owin.Hosting.Tracing;
namespace NzbDrone.Host.Owin
{
public class OwinServiceProvider : IServiceProvider
public static class OwinServiceProviderFactory
{
private readonly IServiceProvider _defaultProvider;
public OwinServiceProvider()
{
_defaultProvider = ServicesFactory.Create();
}
public object GetService(Type serviceType)
public static ServiceProvider Create()
{
if (serviceType == typeof (ITraceOutputFactory))
{
return new OwinTraceOutputFactory();
}
var provider = (ServiceProvider)ServicesFactory.Create();
provider.Add(typeof(ITraceOutputFactory), typeof(OwinTraceOutputFactory));
return _defaultProvider.GetService(serviceType);
return provider;
}
}
}
Loading…
Cancel
Save