Skip to content

Commit

Permalink
Add [request id] context to relevant proxy log entries (#3975)
Browse files Browse the repository at this point in the history
Most `[proxy]` log entries are prefixed with `[request ID]`. The
exception are are entries that are emitted in-between requests.

Before:
```
[proxy] Starting RPC server
[proxy] Processing request 0
[proxy] Starting execute request
[request 0][booster][execute][depth] 0 steps.
...
[proxy] Booster Aborted at Depth {getNat = 0}
[proxy] Simplifying booster state and falling back to Kore
[proxy] Simplifying execution state
...
```
After:
```
[proxy] Starting RPC server
[proxy] Processing request 0
[request 0][proxy] Starting execute request
[request 0][booster][execute][depth] 0 steps.
...
[request 0][proxy] Booster Aborted at Depth {getNat = 0}
[request 0][proxy] Simplifying booster state and falling back to Kore
[request 0][proxy] Simplifying execution state
...
```
  • Loading branch information
geo2a authored Jul 12, 2024
1 parent 0932411 commit 561a538
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions booster/tools/booster/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ main = do

let koreRespond, boosterRespond :: JSONRPC.Id -> Respond (API 'Req) (Booster.Log.LoggerT IO) (API 'Res)
koreRespond reqId = Kore.respond (fromId reqId) kore.serverState (ModuleName kore.mainModule) runSMT
boosterRespond reqId =
Booster.Log.withContextFor reqId
. Booster.Log.withContext CtxBooster
boosterRespond _reqId =
Booster.Log.withContext CtxBooster
. Booster.respond boosterState

proxyConfig =
Expand All @@ -339,9 +338,10 @@ main = do
srvSettings
( \rawReq req ->
let reqId = getReqId rawReq
in runBoosterLogger $
in runBoosterLogger $ do
logRequestId reqId
>> Proxy.respondEither proxyConfig (boosterRespond reqId) (koreRespond reqId) req
Booster.Log.withContextFor reqId $
Proxy.respondEither proxyConfig (boosterRespond reqId) (koreRespond reqId) req
)
[ Kore.handleDecidePredicateUnknown
, Booster.handleSmtError
Expand Down

0 comments on commit 561a538

Please sign in to comment.