2525using System . Diagnostics ;
2626using System . Diagnostics . Tracing ;
2727using System . IO ;
28+ using System . Linq ;
2829using System . Reflection ;
2930using System . Runtime . InteropServices ;
3031using System . Text ;
@@ -234,7 +235,9 @@ public static TraceLogEventSource CreateFromEventPipeSession(EventPipeSession se
234235 // rundown events and shut down immediately and feed this as an additional session to the TraceLog.
235236 // Note: it doesn't matter what the actual provider is, just that we request rundown in the constructor.
236237 using ( var rundownSession = rundownDiagnosticsClient . StartEventPipeSession (
237- new EventPipeProvider ( ClrTraceEventParser . ProviderName , EventLevel . Informational , ( long ) ClrTraceEventParser . Keywords . Default ) ,
238+ rundownConfiguration . m_providers ? . AsEnumerable ( ) ?? new [ ] {
239+ new EventPipeProvider ( ClrTraceEventParser . ProviderName , EventLevel . Informational , ( long ) ClrTraceEventParser . Keywords . Default )
240+ } ,
238241 requestRundown : true
239242 ) )
240243 {
@@ -251,6 +254,7 @@ public static TraceLogEventSource CreateFromEventPipeSession(EventPipeSession se
251254 public class EventPipeRundownConfiguration
252255 {
253256 internal readonly DiagnosticsClient m_client ;
257+ internal List < EventPipeProvider > m_providers ;
254258
255259 private EventPipeRundownConfiguration ( DiagnosticsClient client ) { m_client = client ; }
256260
@@ -272,6 +276,20 @@ public static EventPipeRundownConfiguration Enable(DiagnosticsClient client)
272276 {
273277 return new EventPipeRundownConfiguration ( client ) ;
274278 }
279+
280+ /// <summary>
281+ /// Adds a provider to use when initializing the rundown session.
282+ /// The first call resets the list, removing the default provider (CLR).
283+ /// You can use this if you need to tune the event level, keywords, etc.
284+ /// </summary>
285+ public void AddProvider ( EventPipeProvider provider )
286+ {
287+ if ( m_providers == null )
288+ {
289+ m_providers = new List < EventPipeProvider > ( ) ;
290+ }
291+ m_providers . Add ( provider ) ;
292+ }
275293 }
276294
277295 private void ProcessInitialRundown ( EventPipeSession session )
0 commit comments