Ensure the logger factory is initialized.

This commit is contained in:
Chris Ross 2014-12-02 13:45:29 -08:00
parent 2ecf92f7e8
commit ce8abf7767
2 changed files with 8 additions and 7 deletions

View File

@ -34,7 +34,7 @@ namespace Microsoft.Net.Http.Server
{
if (factory == null)
{
return null;
factory = new LoggerFactory();
}
return factory.Create(type.FullName);

View File

@ -91,12 +91,19 @@ namespace Microsoft.Net.Http.Server
private long? _requestQueueLength;
public WebListener()
: this(new LoggerFactory())
{
}
public WebListener(ILoggerFactory factory)
{
if (!UnsafeNclNativeMethods.HttpApi.Supported)
{
throw new PlatformNotSupportedException();
}
_logger = LogHelper.CreateLogger(factory, typeof(WebListener));
Debug.Assert(UnsafeNclNativeMethods.HttpApi.ApiVersion ==
UnsafeNclNativeMethods.HttpApi.HTTP_API_VERSION.Version20, "Invalid Http api version");
@ -109,12 +116,6 @@ namespace Microsoft.Net.Http.Server
_connectionCancellationTokens = new ConcurrentDictionary<ulong, ConnectionCancellation>();
}
public WebListener(ILoggerFactory factory)
: this()
{
_logger = LogHelper.CreateLogger(factory, typeof(WebListener));
}
internal enum State
{
Stopped,