/// <summary>
        ///     Add the <see cref="HealthStatusJsonOutputFormatter" /> allowing health check results to optionally be reported as JSON.
        /// </summary>
        /// <param name="metricFormattingBuilder">
        ///     The <see cref="IHealthOutputFormattingBuilder" /> used to configure JSON formatting
        ///     options.
        /// </param>
        /// <param name="setupAction">The JSON formatting options to use.</param>
        /// <returns>
        ///     An <see cref="IHealthBuilder" /> that can be used to further configure App Metrics Health.
        /// </returns>
        public static IHealthBuilder AsJson(
            this IHealthOutputFormattingBuilder metricFormattingBuilder,
            Action <HealthJsonOptions> setupAction = null)
        {
            if (metricFormattingBuilder == null)
            {
                throw new ArgumentNullException(nameof(metricFormattingBuilder));
            }

            var options = new HealthJsonOptions();

            setupAction?.Invoke(options);

            var formatter = new HealthStatusJsonOutputFormatter(options.SerializerSettings);

            return(metricFormattingBuilder.Using(formatter));
        }
        /// <summary>
        ///     Add the <see cref="IHealthOutputFormatter" /> allowing health checks to optionally be reported as plain text.
        /// </summary>
        /// <param name="healthFormattingBuilder">
        ///     The <see cref="IHealthOutputFormattingBuilder" /> used to configure formatting
        ///     options.
        /// </param>
        /// <param name="setupAction">The plain text formatting options to use.</param>
        /// <returns>
        ///     An <see cref="IHealthBuilder" /> that can be used to further configure App Metrics Health.
        /// </returns>
        public static IHealthBuilder AsPlainText(
            this IHealthOutputFormattingBuilder healthFormattingBuilder,
            Action <HealthTextOptions> setupAction = null)
        {
            if (healthFormattingBuilder == null)
            {
                throw new ArgumentNullException(nameof(healthFormattingBuilder));
            }

            var options = new HealthTextOptions();

            setupAction?.Invoke(options);

            var formatter = new HealthStatusTextOutputFormatter();

            return(healthFormattingBuilder.Using(formatter));
        }