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

Allow configuring the trace source logger without a TraceListener ins… #431

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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>
@@ -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;
}
@@ -115,7 +119,10 @@ public void Dispose()
{
_disposed = true;
_rootTraceListener.Flush();
_rootTraceListener.Dispose();
if (_rootTraceListener != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so old school

_rootTraceListener?.Dispose();

💃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 PRINT "I AM NOT OLDSCHOOL"
20 GOTO 10

{
_rootTraceListener.Dispose();
}
}
}
}