Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Allow configuring the trace source logger without a TraceListener ins…
Browse files Browse the repository at this point in the history
…tance

Addresses parking lot/I-#405
  • Loading branch information
moozzyk committed May 20, 2016
1 parent 8a7ffd9 commit 978445e
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ public class TraceSourceLoggerProvider : ILoggerProvider

private bool _disposed = false;

/// <summary>
/// Initializes a new instance of the <see cref="TraceSourceLoggerProvider"/> class.
/// </summary>
/// <param name="rootSourceSwitch"></param>
public TraceSourceLoggerProvider(SourceSwitch rootSourceSwitch)
: this(rootSourceSwitch, null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="TraceSourceLoggerProvider"/> class.
/// </summary>
Expand All @@ -32,11 +41,6 @@ public TraceSourceLoggerProvider(SourceSwitch rootSourceSwitch, TraceListener ro
throw new ArgumentNullException(nameof(rootSourceSwitch));
}

if (rootTraceListener == null)
{
throw new ArgumentNullException(nameof(rootTraceListener));
}

_rootSourceSwitch = rootSourceSwitch;
_rootTraceListener = rootTraceListener;
}
Expand Down Expand Up @@ -115,7 +119,10 @@ public void Dispose()
{
_disposed = true;
_rootTraceListener.Flush();
_rootTraceListener.Dispose();
if (_rootTraceListener != null)
{
_rootTraceListener.Dispose();
}
}
}
}
Expand Down

0 comments on commit 978445e

Please sign in to comment.