diff --git a/glean/glass/Glean/Glass/Handler.hs b/glean/glass/Glean/Glass/Handler.hs index 8a4d1f77b..11a89e23c 100644 --- a/glean/glass/Glean/Glass/Handler.hs +++ b/glean/glass/Glean/Glass/Handler.hs @@ -157,7 +157,7 @@ runRepoFile -> RequestOptions -> IO t runRepoFile sym fn env@Glass.Env{..} req opts = - withRepoFile sym env opts (req, opts) repo file $ \gleanDBs dbInfo mlang -> + withRepoFile sym env opts req repo file $ \gleanDBs dbInfo mlang -> fn sourceControl (Glass.repoMapping env) dbInfo req opts GleanBackend{..} snapshotBackend diff --git a/glean/glass/Glean/Glass/Handler/Utils.hs b/glean/glass/Glean/Glass/Handler/Utils.hs index d707ec5ad..f3428685b 100644 --- a/glean/glass/Glean/Glass/Handler/Utils.hs +++ b/glean/glass/Glean/Glass/Handler/Utils.hs @@ -158,7 +158,7 @@ withGleanDBs withGleanDBs method env@Glass.Env{..} opts req repo dbNames fn = do dbInfo <- readTVarIO latestGleanRepos dbs <- getSpecificGleanDBs tracer sourceControl dbInfo (dbChooser repo opts) dbNames - withLog method env req $ \log -> + withLog method env opts req $ \log -> withLogDB dbs log $ fn dbs dbInfo @@ -179,7 +179,7 @@ withRequest withRequest method env@Glass.Env{..} req opts fn = do dbInfo <- readTVarIO latestGleanRepos withStrictErrorHandling dbInfo opts $ - withLog method env req $ + withLog method env opts req $ fn dbInfo -- | Run an action that provides a repo and maybe a language, log it @@ -268,15 +268,16 @@ withLog :: (LogRequest req, LogError req, LogResult res) => Text -> Glass.Env + -> RequestOptions -> req -> (GleanGlassLogger -> IO (res, GleanGlassLogger, Maybe ErrorLogger)) -> IO (res, Maybe ErrorLogger) -withLog cmd env req action = do +withLog cmd env opts req action = do (res, _) <- loggingAction (runLog env cmd) logResult (do - (res, log, merr) <- action $ logRequest req + (res, log, merr) <- action $ logRequest req <> logRequest opts forM_ merr $ \e -> runErrorLog env cmd (e <> logError req) return ((res, merr), log)) return res diff --git a/glean/glass/Glean/Glass/Logging.hs b/glean/glass/Glean/Glass/Logging.hs index 0c1c7ba34..4ba918ce0 100644 --- a/glean/glass/Glean/Glass/Logging.hs +++ b/glean/glass/Glean/Glass/Logging.hs @@ -59,9 +59,6 @@ instance ActionLog GleanGlassLogger where class LogRequest a where logRequest :: a -> GleanGlassLogger -instance LogRequest (DocumentSymbolsRequest, RequestOptions) where - logRequest (d, r) = logRequest d <> logRequest r - instance LogRequest a => LogRequest (Maybe a) where logRequest = maybe mempty logRequest