From 13b4b9e18140749e94e2a705a70961b7d787a1f4 Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Wed, 24 Jul 2024 09:52:31 +0200 Subject: [PATCH] Refactor result printing messages --- booster/tools/booster/Proxy.hs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/booster/tools/booster/Proxy.hs b/booster/tools/booster/Proxy.hs index f20477c1ff..b2a114de9d 100644 --- a/booster/tools/booster/Proxy.hs +++ b/booster/tools/booster/Proxy.hs @@ -356,8 +356,7 @@ respondEither cfg@ProxyConfig{boosterState} booster kore req = case req of | boosterResult.reason `elem` cfg.fallbackReasons -> do Booster.Log.withContext CtxProxy $ Booster.Log.logMessage $ - Text.pack $ - "Booster " <> show boosterResult.reason <> " at " <> show boosterResult.depth + "Booster " <> displayExecuteResultVerbose boosterResult -- simplify Booster's state with Kore's simplifier Booster.Log.withContext CtxProxy $ Booster.Log.logMessage ("Simplifying booster state and falling back to Kore" :: Text) @@ -494,8 +493,8 @@ respondEither cfg@ProxyConfig{boosterState} booster kore req = case req of -- we were successful with the booster, thus we -- return the booster result with the updated -- depth, in case we previously looped - Booster.Log.withContext CtxProxy . Booster.Log.logMessage . Text.pack $ - "Booster " <> show boosterResult.reason <> " at " <> show boosterResult.depth + Booster.Log.withContext CtxProxy . Booster.Log.logMessage $ + "Booster " <> displayExecuteResultVerbose boosterResult -- perform post-exec simplification postExecResult <- simplifyExecResult logSettings r._module def boosterResult @@ -753,3 +752,13 @@ mkFallbackLogEntry boosterResult koreResult = getRewriteSuccessRuleId = \case RPCLog.Rewrite{result = RPCLog.Success{ruleId}} -> Just ruleId _ -> Nothing + +displayExecuteResultVerbose :: ExecuteResult -> Text +displayExecuteResultVerbose result = + Text.pack $ + show result.reason + <> " at " + <> show result.depth + <> " with " + <> show (length <$> result.nextStates) + <> " next states"