@@ -24,7 +24,7 @@ module Optimizely
2424 module Audience
2525 module_function
2626
27- def user_in_experiment? ( config , experiment , attributes )
27+ def user_in_experiment? ( config , experiment , attributes , logger )
2828 # Determine for given experiment if user satisfies the audiences for the experiment.
2929 #
3030 # config - Representation of the Optimizely project config.
@@ -36,7 +36,7 @@ def user_in_experiment?(config, experiment, attributes)
3636
3737 audience_conditions = experiment [ 'audienceConditions' ] || experiment [ 'audienceIds' ]
3838
39- config . logger . log (
39+ logger . log (
4040 Logger ::DEBUG ,
4141 format (
4242 Helpers ::Constants ::AUDIENCE_EVALUATION_LOGS [ 'EVALUATING_AUDIENCES_COMBINED' ] ,
@@ -47,7 +47,7 @@ def user_in_experiment?(config, experiment, attributes)
4747
4848 # Return true if there are no audiences
4949 if audience_conditions . empty?
50- config . logger . log (
50+ logger . log (
5151 Logger ::INFO ,
5252 format (
5353 Helpers ::Constants ::AUDIENCE_EVALUATION_LOGS [ 'AUDIENCE_EVALUATION_RESULT_COMBINED' ] ,
@@ -60,7 +60,7 @@ def user_in_experiment?(config, experiment, attributes)
6060
6161 attributes ||= { }
6262
63- custom_attr_condition_evaluator = CustomAttributeConditionEvaluator . new ( attributes , config . logger )
63+ custom_attr_condition_evaluator = CustomAttributeConditionEvaluator . new ( attributes , logger )
6464
6565 evaluate_custom_attr = lambda do |condition |
6666 return custom_attr_condition_evaluator . evaluate ( condition )
@@ -71,7 +71,7 @@ def user_in_experiment?(config, experiment, attributes)
7171 return nil unless audience
7272
7373 audience_conditions = audience [ 'conditions' ]
74- config . logger . log (
74+ logger . log (
7575 Logger ::DEBUG ,
7676 format (
7777 Helpers ::Constants ::AUDIENCE_EVALUATION_LOGS [ 'EVALUATING_AUDIENCE' ] ,
@@ -83,7 +83,7 @@ def user_in_experiment?(config, experiment, attributes)
8383 audience_conditions = JSON . parse ( audience_conditions ) if audience_conditions . is_a? ( String )
8484 result = ConditionTreeEvaluator . evaluate ( audience_conditions , evaluate_custom_attr )
8585 result_str = result . nil? ? 'UNKNOWN' : result . to_s . upcase
86- config . logger . log (
86+ logger . log (
8787 Logger ::INFO ,
8888 format ( Helpers ::Constants ::AUDIENCE_EVALUATION_LOGS [ 'AUDIENCE_EVALUATION_RESULT' ] , audience_id , result_str )
8989 )
@@ -94,7 +94,7 @@ def user_in_experiment?(config, experiment, attributes)
9494
9595 eval_result ||= false
9696
97- config . logger . log (
97+ logger . log (
9898 Logger ::INFO ,
9999 format (
100100 Helpers ::Constants ::AUDIENCE_EVALUATION_LOGS [ 'AUDIENCE_EVALUATION_RESULT_COMBINED' ] ,
0 commit comments