/// <summary>
        /// Adds a Splunk HTTP Event Collector logger named 'Splunk' to the factory using the specified configuration.
        /// </summary>
        /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
        /// <param name="endpoint">The splunk endpoint type to use, Raw events are only supported in Splunk Enterprise 6.4.0, Splunk Light 6.4.0 and later as well as Splunk Cloud.</param>
        /// <param name="configure">The delegate that configures the LoggerFactory.</param>
        /// <param name="payloadCreator">The delegate that returns an object to pass to the event end point.  Is the endpoint type is <see cref="SplunkEndpoint.Json"/> the object is serialized as Json, if  <see cref="SplunkEndpoint.Json"/> then  <see cref="object.ToString"/> is called.</param>
        /// <returns>The Logging builder being configured.</returns>
        public static ILoggingBuilder AddSplunk(this ILoggingBuilder builder, SplunkEndpoint endpoint, Action <SplunkLoggerOptions> configure, Func <LogData, object> payloadCreator)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            builder.Services.AddSingleton <IHttpClientProvider, HttpClientProvider>();
            builder.Services.AddTransient <ISplunkLoggerProcessor, BatchedSplunkLoggerProcessor>();

            switch (endpoint)
            {
            case SplunkEndpoint.Json:
                builder.AddSplunkJson(configure, payloadCreator);
                break;

            case SplunkEndpoint.Raw:
                builder.AddSplunkRaw(configure, payloadCreator);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(endpoint), endpoint, null);
            }

            builder.Services.Configure(configure);

            return(builder);
        }
 /// <summary>
 /// Adds a Splunk HTTP Event Collector logger named 'Splunk' to the factory using the specified configuration.  <br />
 /// The default payload structure will be used.
 /// </summary>
 /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
 /// <param name="endpoint">The splunk endpoint type to use, Raw events are only supported in Splunk Enterprise 6.4.0, Splunk Light 6.4.0 and later as well as Splunk Cloud.</param>
 /// <param name="configure">The delegate that configures the LoggerFactory.</param>
 /// <returns>The Logging builder being configured.</returns>
 public static ILoggingBuilder AddSplunk(this ILoggingBuilder builder, SplunkEndpoint endpoint, Action <SplunkLoggerOptions> configure)
 {
     return(builder.AddSplunk(endpoint, configure, null));
 }
 /// <summary>
 /// Adds a Splunk HTTP Event Collector logger named 'Splunk' to the factory using the specified configuration. <br />
 /// The default payload structure and options from the existing Configuration will be used.
 /// </summary>
 /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
 /// <param name="endpoint">The splunk endpoint type to use, Raw events are only supported in Splunk Enterprise 6.4.0, Splunk Light 6.4.0 and later as well as Splunk Cloud.</param>
 /// <returns>The Logging builder being configured.</returns>
 public static ILoggingBuilder AddSplunk(this ILoggingBuilder builder, SplunkEndpoint endpoint)
 {
     return(builder.AddSplunk(endpoint, c => { }, null));
 }
 /// <summary>
 /// Adds a Splunk HTTP Event Collector logger named 'Splunk' to the factory using the specified configuration. <br />
 /// The options from the existing Configuration will be used.
 /// </summary>
 /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
 /// <param name="endpoint">The splunk endpoint type to use, Raw events are only supported in Splunk Enterprise 6.4.0, Splunk Light 6.4.0 and later as well as Splunk Cloud.</param>
 /// <param name="payloadCreator">The delegate that returns an object to pass to the event end point.  Is the endpoint type is <see cref="SplunkEndpoint.Json"/> the object is serialized as Json, if  <see cref="SplunkEndpoint.Json"/> then  <see cref="object.ToString"/> is called.</param>
 /// <returns>The Logging builder being configured.</returns>
 public static ILoggingBuilder AddSplunk(this ILoggingBuilder builder, SplunkEndpoint endpoint, Func <LogData, object> payloadCreator)
 {
     return(builder.AddSplunk(endpoint, c => { }, payloadCreator));
 }