1414import org .slf4j .LoggerFactory ;
1515
1616public class UnleashEngine {
17- private static final Logger log = LoggerFactory .getLogger (UnleashEngine .class );
18- private static final Cleaner cleaner = Cleaner .create ();
17+ private static final Logger LOGGER = LoggerFactory .getLogger (UnleashEngine .class );
18+ private static final Cleaner CLEANER = Cleaner .create ();
1919 private final NativeInterface nativeEngine ;
2020 private final CustomStrategiesEvaluator customStrategiesEvaluator ;
2121
@@ -47,7 +47,7 @@ public UnleashEngine(List<IStrategy> customStrategies, IStrategy fallbackStrateg
4747 new CustomStrategiesEvaluator (Stream .empty (), fallbackStrategy , new HashSet <>());
4848 }
4949
50- cleaner .register (this , nativeEngine ::freeEngine );
50+ CLEANER .register (this , nativeEngine ::freeEngine );
5151 }
5252
5353 private static String getRuntimeHostname () {
@@ -161,8 +161,8 @@ private static ByteBuffer buildMessage(
161161
162162 public void takeState (String clientFeatures ) throws YggdrasilInvalidInputException {
163163 try {
164- TakeStateResponse takeStateResponse = this .nativeEngine .takeState (clientFeatures );
165- customStrategiesEvaluator .loadStrategiesFor (takeStateResponse );
164+ TakeStateResponse takeStateResponse = this .nativeEngine .takeState (clientFeatures );
165+ customStrategiesEvaluator .loadStrategiesFor (takeStateResponse );
166166 } catch (RuntimeException e ) {
167167 throw new YggdrasilInvalidInputException ("Failed to take state:" , e );
168168 }
@@ -172,6 +172,7 @@ public FlatResponse<Boolean> isEnabled(String toggleName, Context context)
172172 throws YggdrasilInvalidInputException {
173173 try {
174174 Map <String , Boolean > strategyResults = customStrategiesEvaluator .eval (toggleName , context );
175+ LOGGER .info ("Evaluated custom strategies {}" , strategyResults );
175176 ByteBuffer contextBytes = buildMessage (toggleName , context , strategyResults );
176177 Response response = this .nativeEngine .checkEnabled (contextBytes );
177178
@@ -186,7 +187,7 @@ public FlatResponse<Boolean> isEnabled(String toggleName, Context context)
186187 return new FlatResponse <>(response .impressionData (), null );
187188 }
188189 } catch (RuntimeException e ) {
189- log .warn ("Could not check if toggle is enabled: {}" , e .getMessage (), e );
190+ LOGGER .warn ("Could not check if toggle is enabled: {}" , e .getMessage (), e );
190191 return new FlatResponse <>(false , null );
191192 }
192193 }
@@ -221,7 +222,7 @@ public FlatResponse<VariantDef> getVariant(String toggleName, Context context)
221222 return new FlatResponse <>(false , null );
222223 }
223224 } catch (RuntimeException e ) {
224- log .warn ("Could not get variant for toggle '{}': {}" , toggleName , e .getMessage (), e );
225+ LOGGER .warn ("Could not get variant for toggle '{}': {}" , toggleName , e .getMessage (), e );
225226 return new FlatResponse <>(false , null );
226227 }
227228 }
0 commit comments