Skip to content

Commit

Permalink
feat: warn when IsEnabled falls back to returning default value (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek authored Oct 4, 2023
1 parent 4b4a8e1 commit 8c72fe9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Unleash/DefaultUnleash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private FeatureEvaluationResult CheckIsEnabled(
{
var featureToggle = GetToggle(toggleName);
var enhancedContext = context.ApplyStaticFields(settings);
var enabled = DetermineIsEnabledAndStrategy(featureToggle, enhancedContext, defaultSetting, out var strategy);
var enabled = DetermineIsEnabledAndStrategy(toggleName, featureToggle, enhancedContext, defaultSetting, out var strategy);
var variant = DetermineVariant(enabled, featureToggle, strategy, enhancedContext, defaultVariant);

RegisterCount(toggleName, enabled);
Expand All @@ -125,6 +125,7 @@ private FeatureEvaluationResult CheckIsEnabled(
}

private bool DetermineIsEnabledAndStrategy(
string toggleName,
FeatureToggle featureToggle,
UnleashContext enhancedContext,
bool defaultSetting,
Expand All @@ -133,6 +134,7 @@ private bool DetermineIsEnabledAndStrategy(
strategy = null;
if (featureToggle == null)
{
Logger.Warn($"UNLEASH: Feature flag {toggleName} not present, returning default setting: {defaultSetting}");
return defaultSetting;
}

Expand Down

0 comments on commit 8c72fe9

Please sign in to comment.