mirror of https://github.com/Sonarr/Sonarr
replaced owin's ITraceOutputFactory to one based on nlog that should work on linux.
This commit is contained in:
parent
9b9e1e20eb
commit
6c7e12da5b
|
@ -26,7 +26,6 @@ namespace NzbDrone.Host
|
||||||
|
|
||||||
Container.Register(typeof(IBasicRepository<RootFolder>), typeof(BasicRepository<RootFolder>));
|
Container.Register(typeof(IBasicRepository<RootFolder>), typeof(BasicRepository<RootFolder>));
|
||||||
Container.Register(typeof(IBasicRepository<NamingConfig>), typeof(BasicRepository<NamingConfig>));
|
Container.Register(typeof(IBasicRepository<NamingConfig>), typeof(BasicRepository<NamingConfig>));
|
||||||
Container.Register(typeof(System.IServiceProvider), typeof(OwinServiceProvider));
|
|
||||||
|
|
||||||
Container.Register<INancyBootstrapper, NancyBootstrapper>();
|
Container.Register<INancyBootstrapper, NancyBootstrapper>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,15 +14,13 @@ namespace NzbDrone.Host.Owin
|
||||||
{
|
{
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
private readonly IEnumerable<IOwinMiddleWare> _owinMiddleWares;
|
private readonly IEnumerable<IOwinMiddleWare> _owinMiddleWares;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private IDisposable _host;
|
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;
|
_configFileProvider = configFileProvider;
|
||||||
_owinMiddleWares = owinMiddleWares;
|
_owinMiddleWares = owinMiddleWares;
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +37,7 @@ namespace NzbDrone.Host.Owin
|
||||||
|
|
||||||
_logger.Info("starting server on {0}", url);
|
_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)
|
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;
|
using Microsoft.Owin.Hosting.Tracing;
|
||||||
|
|
||||||
namespace NzbDrone.Host.Owin
|
namespace NzbDrone.Host.Owin
|
||||||
{
|
{
|
||||||
public class OwinServiceProvider : IServiceProvider
|
public static class OwinServiceProviderFactory
|
||||||
{
|
{
|
||||||
private readonly IServiceProvider _defaultProvider;
|
public static ServiceProvider Create()
|
||||||
|
|
||||||
public OwinServiceProvider()
|
|
||||||
{
|
{
|
||||||
_defaultProvider = ServicesFactory.Create();
|
var provider = (ServiceProvider)ServicesFactory.Create();
|
||||||
}
|
provider.Add(typeof(ITraceOutputFactory), typeof(OwinTraceOutputFactory));
|
||||||
public object GetService(Type serviceType)
|
|
||||||
{
|
|
||||||
if (serviceType == typeof (ITraceOutputFactory))
|
|
||||||
{
|
|
||||||
return new OwinTraceOutputFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _defaultProvider.GetService(serviceType);
|
return provider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue