From 79caf8c55842965c51b377d1797d3f6fdef294b9 Mon Sep 17 00:00:00 2001 From: Georgy Lukyanov Date: Thu, 26 Sep 2024 08:48:03 +0200 Subject: [PATCH 1/2] Fix handling of logging contextx in `booster-dev` (#4051) This small PR: - adds `[request ID]` contexts to logs emitted from `booster-dev`, similarly to `kore-rpc-booster` - the above also makes the per-defined logging contexts `Booster.CLIOptions` useful again, as they did not match before due to the absence of `[request ID]` - redirects the log messages to a file if asked for - also lists the available logging formats in `--help` --- booster/library/Booster/CLOptions.hs | 7 +++++-- dev-tools/booster-dev/Server.hs | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/booster/library/Booster/CLOptions.hs b/booster/library/Booster/CLOptions.hs index cb2a758d29..997d3f6890 100644 --- a/booster/library/Booster/CLOptions.hs +++ b/booster/library/Booster/CLOptions.hs @@ -66,7 +66,7 @@ data LogFormat = Standard | OneLine | Json - deriving (Eq) + deriving (Eq, Enum) instance Show LogFormat where show = \case @@ -155,7 +155,10 @@ parseLogOptions = ( metavar "LOGFORMAT" <> value OneLine <> long "log-format" - <> help "Format to output logs in" + <> help + ( "Format to output logs in. Available formats: " + <> intercalate ", " (map show $ enumFrom (toEnum @LogFormat 0)) + ) <> showDefault ) <*> many diff --git a/dev-tools/booster-dev/Server.hs b/dev-tools/booster-dev/Server.hs index 3710c588e8..3921086175 100644 --- a/dev-tools/booster-dev/Server.hs +++ b/dev-tools/booster-dev/Server.hs @@ -143,7 +143,7 @@ runServer port definitions defaultMain mLlvmLibrary rewriteOpts logFile mSMTOpti withFastLogger mTimeCache logFile $ \stderrLogger mFileLogger -> do let boosterContextLogger = case logFormat of Json -> Booster.Log.jsonLogger $ fromMaybe stderrLogger mFileLogger - _ -> Booster.Log.textLogger stderrLogger + _ -> Booster.Log.textLogger $ fromMaybe stderrLogger mFileLogger filteredBoosterContextLogger = flip Booster.Log.filterLogger boosterContextLogger $ \(Booster.Log.LogMessage (Booster.Flag alwaysDisplay) ctxts _) -> alwaysDisplay @@ -163,10 +163,12 @@ runServer port definitions defaultMain mLlvmLibrary rewriteOpts logFile mSMTOpti } jsonRpcServer (serverSettings port "*") - ( const $ + ( \rawReq req -> flip runReaderT (filteredBoosterContextLogger, toModifiersRep prettyPrintOptions) . Booster.Log.unLoggerT + . Booster.Log.withContextFor (getReqId rawReq) . Booster.Log.withContext Booster.Log.CtxBooster . respond stateVar + $ req ) [handleSmtError, RpcError.handleErrorCall, RpcError.handleSomeException] From 4e95286ea68d4f0b1499d3e3e0cab4f3c5804624 Mon Sep 17 00:00:00 2001 From: rv-jenkins Date: Tue, 1 Oct 2024 07:07:24 -0600 Subject: [PATCH 2/2] Update dependency: deps/k_release (#4052) Co-authored-by: devops --- deps/k_release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/k_release b/deps/k_release index acf79a8b24..1ef9950c91 100644 --- a/deps/k_release +++ b/deps/k_release @@ -1 +1 @@ -7.1.149 +7.1.151