<commit_before>﻿using Serilog.Configuration;
using SerilogWeb.Classic.Enrichers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Serilog
{
    /// <summary>
    /// Extends <see cref="LoggerConfiguration"/> to add enrichers for SerilogWeb.Classic's logging module 
    /// </summary>
    public static class SerilogWebClassicLoggerConfigurationExtensions
    {
        /// <summary>
        /// Enrich log events with the named Claim Value.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="claimProperty">The claim property name searched for value to enrich log events.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithClaimValue(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            string claimProperty)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new ClaimValueEnricher(claimProperty));
        }

        /// <summary>
        /// Enrich log events with the named Claim Value.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="claimProperty">The claim property name searched for value to enrich log events.</param>
        /// <param name="logEventProperty">The property name added to enriched log events.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithClaimValue(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            string claimProperty,
            string logEventProperty)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new ClaimValueEnricher(claimProperty, logEventProperty));
        }


        /// <summary>
        /// Enrich log events with the Client IP Address.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="checkForHttpProxies">if set to <c>true</c> this Enricher also checks for HTTP proxies and their X-FORWARDED-FOR header.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithHttpRequestClientHostIP(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            bool checkForHttpProxies = true)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new HttpRequestClientHostIPEnricher(checkForHttpProxies));
        }
    }
}<commit_msg>Add configuration extensions for HttpRequestClientHostNameEnricher<commit_after>﻿using Serilog.Configuration;
using SerilogWeb.Classic.Enrichers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Serilog
{
    /// <summary>
    /// Extends <see cref="LoggerConfiguration"/> to add enrichers for SerilogWeb.Classic's logging module 
    /// </summary>
    public static class SerilogWebClassicLoggerConfigurationExtensions
    {
        /// <summary>
        /// Enrich log events with the named Claim Value.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="claimProperty">The claim property name searched for value to enrich log events.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithClaimValue(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            string claimProperty)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new ClaimValueEnricher(claimProperty));
        }

        /// <summary>
        /// Enrich log events with the named Claim Value.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="claimProperty">The claim property name searched for value to enrich log events.</param>
        /// <param name="logEventProperty">The property name added to enriched log events.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithClaimValue(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            string claimProperty,
            string logEventProperty)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new ClaimValueEnricher(claimProperty, logEventProperty));
        }


        /// <summary>
        /// Enrich log events with the Client IP Address.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <param name="checkForHttpProxies">if set to <c>true</c> this Enricher also checks for HTTP proxies and their X-FORWARDED-FOR header.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithHttpRequestClientHostIP(
            this LoggerEnrichmentConfiguration enrichmentConfiguration,
            bool checkForHttpProxies = true)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With(new HttpRequestClientHostIPEnricher(checkForHttpProxies));
        }

        /// <summary>
        /// Enrich log events with the Client Host Name.
        /// </summary>
        /// <param name="enrichmentConfiguration">Logger enrichment configuration.</param>
        /// <returns>Configuration object allowing method chaining.</returns>
        public static LoggerConfiguration WithHttpRequestClientHostName(
            this LoggerEnrichmentConfiguration enrichmentConfiguration)
        {
            if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
            return enrichmentConfiguration.With<HttpRequestClientHostNameEnricher>();
        }
    }
}
{'fraction_non_alphanumeric': 0.08912364231513167, 'fraction_numerical': 0.0, 'mean_word_length': 3.0251497005988024, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1117753', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1500, 'n_words': 430}