Skip to content

Commit f4b577e

Browse files
committed
update logs
1 parent ea3fa48 commit f4b577e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/Optimizely/Optimizely.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ private function getFeatureVariableValueFromVariation($featureFlagKey, $variable
931931
if ($variation === null) {
932932
$this->_logger->log(
933933
Logger::INFO,
934-
"User '{$userId}'is not in any variation, ".
934+
"User '{$userId}' is not in experiment or rollout, ".
935935
"returning default value '{$variableValue}'."
936936
);
937937
} else {
@@ -941,14 +941,13 @@ private function getFeatureVariableValueFromVariation($featureFlagKey, $variable
941941
$variableValue = $variableUsage->getValue();
942942
$this->_logger->log(
943943
Logger::INFO,
944-
"Returning variable value '{$variableValue}' for variation '{$variation->getKey()}' ".
945-
"of feature flag '{$featureFlagKey}'"
944+
"Returning variable value '{$variableValue}' for variable key '{$variableKey}' ".
945+
"of feature flag '{$featureFlagKey}'."
946946
);
947947
} else {
948948
$this->_logger->log(
949949
Logger::INFO,
950-
"Variable '{$variableKey}' is not used in variation '{$variation->getKey()}', ".
951-
"returning default value '{$variableValue}'."
950+
"Variable value is not defined. Returning the default variable value '{$variableValue}'."
952951
);
953952
}
954953
} else {

tests/OptimizelyTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,7 +3558,7 @@ public function testGetFeatureVariableValueForTypeGivenFeatureFlagIsNotEnabledFo
35583558
->method('log')
35593559
->with(
35603560
Logger::INFO,
3561-
"User 'user_id'is not in any variation, returning default value '14.99'."
3561+
"User 'user_id' is not in experiment or rollout, returning default value '14.99'."
35623562
);
35633563

35643564
$this->assertSame(
@@ -3595,8 +3595,8 @@ public function testGetFeatureVariableValueForTypeGivenFeatureFlagIsEnabledForUs
35953595
->method('log')
35963596
->with(
35973597
Logger::INFO,
3598-
"Returning variable value '42.42' for variation 'control' ".
3599-
"of feature flag 'double_single_variable_feature'"
3598+
"Returning variable value '42.42' for variable key 'double_variable' ".
3599+
"of feature flag 'double_single_variable_feature'."
36003600
);
36013601

36023602
$this->assertSame(
@@ -3675,8 +3675,8 @@ public function testGetFeatureVariableValueForTypeWithRolloutRule()
36753675
->method('log')
36763676
->with(
36773677
Logger::INFO,
3678-
"Returning variable value 'true' for variation '177771' ".
3679-
"of feature flag 'boolean_single_variable_feature'"
3678+
"Returning variable value 'true' for variable key 'boolean_variable' ".
3679+
"of feature flag 'boolean_single_variable_feature'."
36803680
);
36813681

36823682
$this->assertTrue($this->optimizelyObject->getFeatureVariableBoolean('boolean_single_variable_feature', 'boolean_variable', 'user_id', []));
@@ -3751,7 +3751,7 @@ public function testGetFeatureVariableValueForTypeGivenFeatureFlagIsEnabledForUs
37513751
->method('log')
37523752
->with(
37533753
Logger::INFO,
3754-
"Variable 'double_variable' is not used in variation 'control', returning default value '14.99'."
3754+
"Variable value is not defined. Returning the default variable value '14.99'."
37553755
);
37563756

37573757
$this->assertSame(
@@ -3793,11 +3793,11 @@ public function testGetFeatureVariableValueForTypeWithEmptyUserID()
37933793
->method('log')
37943794
->with(
37953795
Logger::INFO,
3796-
"User ''is not in any variation, returning default value '14.99'."
3796+
"User 'test_user' is not in experiment or rollout, returning default value '14.99'."
37973797
);
37983798

37993799
$this->assertSame(
3800-
$this->optimizelyObject->getFeatureVariableValueForType('double_single_variable_feature', 'double_variable', '', [], 'double'),
3800+
$this->optimizelyObject->getFeatureVariableValueForType('double_single_variable_feature', 'double_variable', 'test_user', [], 'double'),
38013801
14.99
38023802
);
38033803
}
@@ -4254,8 +4254,8 @@ public function testGetAllFeatureVariablesGivenFeatureFlagIsEnabledForUserAndVar
42544254
->method('log')
42554255
->with(
42564256
Logger::INFO,
4257-
"Returning variable value '42.42' for variation 'control' ".
4258-
"of feature flag 'double_single_variable_feature'"
4257+
"Returning variable value '42.42' for variable key 'double_variable'".
4258+
" of feature flag 'double_single_variable_feature'."
42594259
);
42604260

42614261
$this->assertSame(

0 commit comments

Comments
 (0)