From 5fb7f10067369e8ab5f450ef5cd7c29df903b84b Mon Sep 17 00:00:00 2001 From: Roman Zaynetdinov Date: Thu, 8 Feb 2024 11:03:29 +0200 Subject: [PATCH] Log flag name when failed to compute it locally Atm it is impossible to tell which flag failed to be computed locally. Before: ``` Unable to compute flag locally - Can't determine if feature flag is enabled or not with given properties ``` After: ``` Unable to compute flag locally (my_test) - Can't determine if feature flag is enabled or not with given properties ``` --- featureflags.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/featureflags.go b/featureflags.go index 012d1de..732a9ba 100644 --- a/featureflags.go +++ b/featureflags.go @@ -201,7 +201,7 @@ func (poller *FeatureFlagsPoller) GetFeatureFlag(flagConfig FeatureFlagPayload) } if err != nil { - poller.Errorf("Unable to compute flag locally - %s", err) + poller.Errorf("Unable to compute flag locally (%s) - %s", featureFlag.Key, err) } if (err != nil || result == nil) && !flagConfig.OnlyEvaluateLocally { @@ -226,7 +226,7 @@ func (poller *FeatureFlagsPoller) GetAllFlags(flagConfig FeatureFlagPayloadNoKey for _, storedFlag := range featureFlags { result, err := poller.computeFlagLocally(storedFlag, flagConfig.DistinctId, flagConfig.Groups, flagConfig.PersonProperties, flagConfig.GroupProperties) if err != nil { - poller.Errorf("Unable to compute flag locally - %s", err) + poller.Errorf("Unable to compute flag locally (%s) - %s", storedFlag.Key, err) fallbackToDecide = true } else { response[storedFlag.Key] = result