public EtwInput(IConfiguration configuration, IHealthReporter healthReporter) { Requires.NotNull(configuration, nameof(configuration)); Requires.NotNull(healthReporter, nameof(healthReporter)); string sessionNamePrefix = configuration.GetValue <string>("sessionNamePrefix", DefaultSessionnamePrefix); bool cleanupOldSessions = configuration.GetValue <bool>("cleanupOldSessions", false); bool reuseExistingSession = configuration.GetValue <bool>("reuseExistingSession", false); IConfiguration providersConfiguration = configuration.GetSection(ProvidersSectionName); if (providersConfiguration == null) { healthReporter.ReportProblem($"{nameof(EtwInput)}: required configuration section '{ProvidersSectionName}' is missing"); return; } var providers = new List <EtwProviderConfiguration>(); ConfigUtil.ConvertKeywordsToDecimal(providersConfiguration); try { providersConfiguration.Bind(providers); } catch { healthReporter.ReportProblem($"{nameof(EtwInput)}: configuration is invalid", EventFlowContextIdentifiers.Configuration); return; } Initialize(providers, sessionNamePrefix, cleanupOldSessions, reuseExistingSession, healthReporter); }
public EventSourceInput(IConfiguration configuration, IHealthReporter healthReporter) { Requires.NotNull(configuration, nameof(configuration)); Requires.NotNull(healthReporter, nameof(healthReporter)); IConfiguration sourcesConfiguration = configuration.GetSection("sources"); if (sourcesConfiguration == null) { healthReporter.ReportProblem($"{nameof(EventSourceInput)}: required configuration section 'sources' is missing"); return; } var eventSources = new List <EventSourceConfiguration>(); ConfigUtil.ConvertKeywordsToDecimal(sourcesConfiguration); try { sourcesConfiguration.Bind(eventSources); } catch { healthReporter.ReportProblem($"{nameof(EventSourceInput)}: configuration is invalid", EventFlowContextIdentifiers.Configuration); return; } Initialize(eventSources, healthReporter); }