public static HeaderLimitFactory <THeader> Add <THeader, TLogger>(this HeaderLimitFactory <THeader> factory, THeader header, string key, string value, ILogger <TLogger> logger) where THeader : IHeaderLimit
 {
     if (header.LogAll)
     {
         logger.LogDebug("Header {0} : {1} for tag: {2}", key, value, header.Tag);
     }
     if (int.TryParse(value, out int i))
     {
         factory.AddToDictionary(header, key, i);
     }
     return(factory);
 }
        public static HeaderLimitFactory <THeader> Log <THeader, TLogger>(this HeaderLimitFactory <THeader> factory, THeader header, ILogger <TLogger> logger) where THeader : IHeaderLimit
        {
            var ratio = factory.GetRemainingLimitRatio(header);

            if (!ratio.HasValue)
            {
                return(factory);
            }
            var message = $"{header.Name} remaining is {ratio}% of limits for tag : {header.Tag} and Uri : {header.Uri}";

            if (ratio <= 70m && ratio > 0)
            {
                logger.LogWarning(message);
            }
            else if (ratio == 0)
            {
                logger.LogError(message);
            }

            return(factory);
        }