Skip to content

Commit d137af6

Browse files
authored
Only emit proxy branch-eliminating rewrite trace when asked (#3976)
Follow-up to #3974
1 parent 95d7d59 commit d137af6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

booster/tools/booster/Proxy.hs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -642,22 +642,25 @@ respondEither cfg@ProxyConfig{boosterState} booster kore req = case req of
642642
-- extract the rule-id information from the result we proceed with
643643
let onlyNext = head filteredNexts
644644
rewriteRuleId = fromMaybe "UNKNOWN" onlyNext.ruleId
645-
proxyRewriteStepLog =
646-
RPCLog.Rewrite
647-
{ result =
648-
RPCLog.Success
649-
{ rewrittenTerm = Nothing
650-
, substitution = Nothing
651-
, ruleId = rewriteRuleId
645+
proxyRewriteStepLogs
646+
| Just True <- logSettings.logSuccessfulRewrites =
647+
Just . (: []) $
648+
RPCLog.Rewrite
649+
{ result =
650+
RPCLog.Success
651+
{ rewrittenTerm = Nothing
652+
, substitution = Nothing
653+
, ruleId = rewriteRuleId
654+
}
655+
, origin = RPCLog.Proxy
652656
}
653-
, origin = RPCLog.Proxy
654-
}
657+
| otherwise = Nothing
655658
Booster.Log.withContext CtxProxy $
656659
Booster.Log.logMessage' ("Continuing after rewriting with rule " <> rewriteRuleId)
657660
pure $
658661
Left
659662
( execStateToKoreJson onlyNext
660-
, logsOnly <> filteredNextLogs <> [Just [proxyRewriteStepLog]]
663+
, logsOnly <> filteredNextLogs <> [proxyRewriteStepLogs]
661664
)
662665
-- otherwise falling through to _otherReason
663666
CutPointRule

0 commit comments

Comments
 (0)