diff --git a/src/ConfigCat.Client.Tests/data/evaluationlog/epoch_date_validation/date_error.txt b/src/ConfigCat.Client.Tests/data/evaluationlog/epoch_date_validation/date_error.txt index 3a24084d..fbde23f9 100644 --- a/src/ConfigCat.Client.Tests/data/evaluationlog/epoch_date_validation/date_error.txt +++ b/src/ConfigCat.Client.Tests/data/evaluationlog/epoch_date_validation/date_error.txt @@ -1,4 +1,4 @@ -WARNING [3004] Cannot evaluate condition (User.Custom1 AFTER '1680307200' (2023-04-01T00:00:00.000Z UTC)) for setting 'boolTrueIn202304' ('2023.04.10' is not a valid Unix timestamp (number of seconds elapsed since Unix epoch)). Please check the User.Custom1 attribute and make sure that its value corresponds to the AFTER operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 AFTER '1680307200' (2023-04-01T00:00:00.000Z UTC)) for setting 'boolTrueIn202304' ('2023.04.10' is not a valid Unix timestamp (number of seconds elapsed since Unix epoch)). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. INFO [5000] Evaluating 'boolTrueIn202304' for User '{"Identifier":"12345","Custom1":"2023.04.10"}' Evaluating targeting rules and applying the first match if any: - IF User.Custom1 AFTER '1680307200' (2023-04-01T00:00:00.000Z UTC) => false, skipping the remaining AND conditions diff --git a/src/ConfigCat.Client.Tests/data/evaluationlog/number_validation/number_error.txt b/src/ConfigCat.Client.Tests/data/evaluationlog/number_validation/number_error.txt index de6127f4..f9368093 100644 --- a/src/ConfigCat.Client.Tests/data/evaluationlog/number_validation/number_error.txt +++ b/src/ConfigCat.Client.Tests/data/evaluationlog/number_validation/number_error.txt @@ -1,4 +1,4 @@ -WARNING [3004] Cannot evaluate condition (User.Custom1 != '5') for setting 'number' ('not_a_number' is not a valid decimal number). Please check the User.Custom1 attribute and make sure that its value corresponds to the != operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 != '5') for setting 'number' ('not_a_number' is not a valid decimal number). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. INFO [5000] Evaluating 'number' for User '{"Identifier":"12345","Custom1":"not_a_number"}' Evaluating targeting rules and applying the first match if any: - IF User.Custom1 != '5' THEN '<>5' => cannot evaluate, the User.Custom1 attribute is invalid ('not_a_number' is not a valid decimal number) diff --git a/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_error.txt b/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_error.txt index 3840d3f2..e14cc952 100644 --- a/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_error.txt +++ b/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_error.txt @@ -1,5 +1,5 @@ -WARNING [3004] Cannot evaluate condition (User.Custom1 IS NOT ONE OF ['1.0.0', '1.0.1', '2.0.0', '2.0.1', '2.0.2', '']) for setting 'isNotOneOf' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the IS NOT ONE OF operator. -WARNING [3004] Cannot evaluate condition (User.Custom1 IS NOT ONE OF ['1.0.0', '3.0.1']) for setting 'isNotOneOf' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the IS NOT ONE OF operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 IS NOT ONE OF ['1.0.0', '1.0.1', '2.0.0', '2.0.1', '2.0.2', '']) for setting 'isNotOneOf' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 IS NOT ONE OF ['1.0.0', '3.0.1']) for setting 'isNotOneOf' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. INFO [5000] Evaluating 'isNotOneOf' for User '{"Identifier":"12345","Custom1":"wrong_semver"}' Evaluating targeting rules and applying the first match if any: - IF User.Custom1 IS NOT ONE OF ['1.0.0', '1.0.1', '2.0.0', '2.0.1', '2.0.2', ''] THEN 'Is not one of (1.0.0, 1.0.1, 2.0.0 , 2.0.1, 2.0.2, )' => cannot evaluate, the User.Custom1 attribute is invalid ('wrong_semver' is not a valid semantic version) diff --git a/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_relations_error.txt b/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_relations_error.txt index 4a841878..8198c854 100644 --- a/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_relations_error.txt +++ b/src/ConfigCat.Client.Tests/data/evaluationlog/semver_validation/semver_relations_error.txt @@ -1,8 +1,8 @@ -WARNING [3004] Cannot evaluate condition (User.Custom1 < '1.0.0,') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the < operator. -WARNING [3004] Cannot evaluate condition (User.Custom1 < '1.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the < operator. -WARNING [3004] Cannot evaluate condition (User.Custom1 <= '1.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the <= operator. -WARNING [3004] Cannot evaluate condition (User.Custom1 > '2.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the > operator. -WARNING [3004] Cannot evaluate condition (User.Custom1 >= '2.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the >= operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 < '1.0.0,') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 < '1.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 <= '1.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 > '2.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. +WARNING [3004] Cannot evaluate condition (User.Custom1 >= '2.0.0') for setting 'relations' ('wrong_semver' is not a valid semantic version). Please check the User.Custom1 attribute and make sure that its value corresponds to the comparison operator. INFO [5000] Evaluating 'relations' for User '{"Identifier":"12345","Custom1":"wrong_semver"}' Evaluating targeting rules and applying the first match if any: - IF User.Custom1 < '1.0.0,' THEN '<1.0.0,' => cannot evaluate, the User.Custom1 attribute is invalid ('wrong_semver' is not a valid semantic version) diff --git a/src/ConfigCatClient/Evaluation/RolloutEvaluator.cs b/src/ConfigCatClient/Evaluation/RolloutEvaluator.cs index b9d763e5..69485d1b 100644 --- a/src/ConfigCatClient/Evaluation/RolloutEvaluator.cs +++ b/src/ConfigCatClient/Evaluation/RolloutEvaluator.cs @@ -722,7 +722,7 @@ private static T EnsureComparisonValue([NotNull] T? value) private string HandleInvalidSemVerUserAttribute(UserCondition condition, string key, string userAttributeName, string userAttributeValue) { var reason = $"'{userAttributeValue}' is not a valid semantic version"; - this.logger.UserObjectAttributeIsInvalid(condition.ToString(), key, reason, userAttributeName, condition.Comparator.ToDisplayText()); + this.logger.UserObjectAttributeIsInvalid(condition.ToString(), key, reason, userAttributeName); return string.Format(CultureInfo.InvariantCulture, InvalidUserAttributeError, userAttributeName, reason); } @@ -731,7 +731,7 @@ private string HandleInvalidNumberUserAttribute(UserCondition condition, string var reason = isDateTime ? $"'{userAttributeValue}' is not a valid Unix timestamp (number of seconds elapsed since Unix epoch)" : $"'{userAttributeValue}' is not a valid decimal number"; - this.logger.UserObjectAttributeIsInvalid(condition.ToString(), key, reason, userAttributeName, condition.Comparator.ToDisplayText()); + this.logger.UserObjectAttributeIsInvalid(condition.ToString(), key, reason, userAttributeName); return string.Format(CultureInfo.InvariantCulture, InvalidUserAttributeError, userAttributeName, reason); } } diff --git a/src/ConfigCatClient/Logging/LogMessages.cs b/src/ConfigCatClient/Logging/LogMessages.cs index fe69c216..34de3d30 100644 --- a/src/ConfigCatClient/Logging/LogMessages.cs +++ b/src/ConfigCatClient/Logging/LogMessages.cs @@ -131,10 +131,10 @@ public static FormattableLogMessage UserObjectAttributeIsMissing(this LoggerWrap $"Cannot evaluate condition ({condition}) for setting '{key}' (the User.{attributeName} attribute is missing). You should set the User.{attributeName} attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/", "CONDITION", "KEY", "ATTRIBUTE_NAME", "ATTRIBUTE_NAME"); - public static FormattableLogMessage UserObjectAttributeIsInvalid(this LoggerWrapper logger, string condition, string key, string reason, string attributeName, string @operator) => logger.LogInterpolated( + public static FormattableLogMessage UserObjectAttributeIsInvalid(this LoggerWrapper logger, string condition, string key, string reason, string attributeName) => logger.LogInterpolated( LogLevel.Warning, 3004, - $"Cannot evaluate condition ({condition}) for setting '{key}' ({reason}). Please check the User.{attributeName} attribute and make sure that its value corresponds to the {@operator} operator.", - "CONDITION", "KEY", "REASON", "ATTRIBUTE_NAME", "OPERATOR"); + $"Cannot evaluate condition ({condition}) for setting '{key}' ({reason}). Please check the User.{attributeName} attribute and make sure that its value corresponds to the comparison operator.", + "CONDITION", "KEY", "REASON", "ATTRIBUTE_NAME"); public static FormattableLogMessage CircularDependencyDetected(this LoggerWrapper logger, string condition, string key, string dependencyCycle) => logger.LogInterpolated( LogLevel.Warning, 3005,