コード例 #1
0
        public static ILoggerFactory AddEventHub(this ILoggerFactory loggerFactory, Action <EventHubLogProviderOptions> config)
        {
            var options = new EventHubLogProviderOptions();

            config(options);
            options.Validate();
            loggerFactory.AddProvider(new EventHubLoggerProvider(options,
                                                                 new EventHubLog(new EventHubClientWrapper(options.EventHubConnectionString, options.EventHubEntityPath))));
            return(loggerFactory);
        }
コード例 #2
0
        [ExcludeFromCodeCoverage] // this is not testable due to AddProvider being a Microsoft extension method
        public static ILoggingBuilder AddEventHub(this ILoggingBuilder loggingBuilder, Action <EventHubLogProviderOptions> config)
        {
            var options = new EventHubLogProviderOptions();

            config(options);
            options.Validate();
            loggingBuilder.AddProvider(new EventHubLoggerProvider(options,
                                                                  new EventHubLog(new EventHubClientWrapper(options.EventHubConnectionString, options.EventHubEntityPath, options.AzureStorageLogProviderOptions))));
            return(loggingBuilder);
        }