From d137af69b1b020106f10a6c766d06c845821363c Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Fri, 12 Jul 2024 11:12:26 +0200 Subject: [PATCH] Only emit proxy branch-eliminating rewrite trace when asked (#3976) Follow-up to #3974 --- booster/tools/booster/Proxy.hs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/booster/tools/booster/Proxy.hs b/booster/tools/booster/Proxy.hs index cbf085b7e0..f762d6a77e 100644 --- a/booster/tools/booster/Proxy.hs +++ b/booster/tools/booster/Proxy.hs @@ -642,22 +642,25 @@ respondEither cfg@ProxyConfig{boosterState} booster kore req = case req of -- extract the rule-id information from the result we proceed with let onlyNext = head filteredNexts rewriteRuleId = fromMaybe "UNKNOWN" onlyNext.ruleId - proxyRewriteStepLog = - RPCLog.Rewrite - { result = - RPCLog.Success - { rewrittenTerm = Nothing - , substitution = Nothing - , ruleId = rewriteRuleId + proxyRewriteStepLogs + | Just True <- logSettings.logSuccessfulRewrites = + Just . (: []) $ + RPCLog.Rewrite + { result = + RPCLog.Success + { rewrittenTerm = Nothing + , substitution = Nothing + , ruleId = rewriteRuleId + } + , origin = RPCLog.Proxy } - , origin = RPCLog.Proxy - } + | otherwise = Nothing Booster.Log.withContext CtxProxy $ Booster.Log.logMessage' ("Continuing after rewriting with rule " <> rewriteRuleId) pure $ Left ( execStateToKoreJson onlyNext - , logsOnly <> filteredNextLogs <> [Just [proxyRewriteStepLog]] + , logsOnly <> filteredNextLogs <> [proxyRewriteStepLogs] ) -- otherwise falling through to _otherReason CutPointRule