Ensure the logger factory is initialized.
This commit is contained in:
parent
2ecf92f7e8
commit
ce8abf7767
|
|
@ -34,7 +34,7 @@ namespace Microsoft.Net.Http.Server
|
||||||
{
|
{
|
||||||
if (factory == null)
|
if (factory == null)
|
||||||
{
|
{
|
||||||
return null;
|
factory = new LoggerFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
return factory.Create(type.FullName);
|
return factory.Create(type.FullName);
|
||||||
|
|
|
||||||
|
|
@ -91,12 +91,19 @@ namespace Microsoft.Net.Http.Server
|
||||||
private long? _requestQueueLength;
|
private long? _requestQueueLength;
|
||||||
|
|
||||||
public WebListener()
|
public WebListener()
|
||||||
|
: this(new LoggerFactory())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebListener(ILoggerFactory factory)
|
||||||
{
|
{
|
||||||
if (!UnsafeNclNativeMethods.HttpApi.Supported)
|
if (!UnsafeNclNativeMethods.HttpApi.Supported)
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException();
|
throw new PlatformNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger = LogHelper.CreateLogger(factory, typeof(WebListener));
|
||||||
|
|
||||||
Debug.Assert(UnsafeNclNativeMethods.HttpApi.ApiVersion ==
|
Debug.Assert(UnsafeNclNativeMethods.HttpApi.ApiVersion ==
|
||||||
UnsafeNclNativeMethods.HttpApi.HTTP_API_VERSION.Version20, "Invalid Http api version");
|
UnsafeNclNativeMethods.HttpApi.HTTP_API_VERSION.Version20, "Invalid Http api version");
|
||||||
|
|
||||||
|
|
@ -109,12 +116,6 @@ namespace Microsoft.Net.Http.Server
|
||||||
_connectionCancellationTokens = new ConcurrentDictionary<ulong, ConnectionCancellation>();
|
_connectionCancellationTokens = new ConcurrentDictionary<ulong, ConnectionCancellation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebListener(ILoggerFactory factory)
|
|
||||||
: this()
|
|
||||||
{
|
|
||||||
_logger = LogHelper.CreateLogger(factory, typeof(WebListener));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal enum State
|
internal enum State
|
||||||
{
|
{
|
||||||
Stopped,
|
Stopped,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue