Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Feb 14, 2024
1 parent 4ab88d3 commit bbf2f98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/ConfigCatClient/Evaluation/EvaluateLogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ internal static class EvaluateLogHelper

internal const int StringListMaxLength = 10;

public static IndentedTextBuilder AppendEvaluationResult(this IndentedTextBuilder builder, bool result)
{
return builder.Append(result ? "true" : "false");
}

private static IndentedTextBuilder AppendUserCondition(this IndentedTextBuilder builder, string? comparisonAttribute, UserComparator comparator, object? comparisonValue)
{
return builder.Append($"User.{comparisonAttribute} {comparator.ToDisplayText()} '{comparisonValue ?? InvalidValuePlaceholder}'");
Expand Down Expand Up @@ -148,9 +143,14 @@ public static IndentedTextBuilder AppendSegmentCondition(this IndentedTextBuilde
return builder.Append($"User {comparator.ToDisplayText()} '{segmentName}'");
}

public static IndentedTextBuilder AppendConditionResult(this IndentedTextBuilder builder, bool result)
{
return builder.Append(result ? "true" : "false");
}

public static IndentedTextBuilder AppendConditionConsequence(this IndentedTextBuilder builder, bool result)
{
builder.Append(" => ").AppendEvaluationResult(result);
builder.Append(" => ").AppendConditionResult(result);
return result ? builder : builder.Append(", skipping the remaining AND conditions");
}

Expand Down
4 changes: 2 additions & 2 deletions src/ConfigCatClient/Evaluation/RolloutEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ private bool EvaluatePrerequisiteFlagCondition(PrerequisiteFlagCondition conditi
.NewLine().Append($"Prerequisite flag evaluation result: '{prerequisiteFlagValue}'.")
.NewLine("Condition (")
.AppendPrerequisiteFlagCondition(condition, context.Settings)
.Append(") evaluates to ").AppendEvaluationResult(result).Append(".")
.Append(") evaluates to ").AppendConditionResult(result).Append(".")
.DecreaseIndent()
.NewLine(")");

Expand Down Expand Up @@ -823,7 +823,7 @@ private bool EvaluateSegmentCondition(SegmentCondition condition, ref EvaluateCo

logBuilder.NewLine("Condition (").AppendSegmentCondition(condition).Append(")");
(error is null
? logBuilder.Append(" evaluates to ").AppendEvaluationResult(result)
? logBuilder.Append(" evaluates to ").AppendConditionResult(result)
: logBuilder.Append(" failed to evaluate"))
.Append(".");

Expand Down

0 comments on commit bbf2f98

Please sign in to comment.