Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
Summary:
Log all `RequestOptions`

logger metadata updated with:

```
buck2 run dsi/logger/hs/sync:sync_logger_configs -- --config GleanGlassLoggerConfig --source_dir .
```

Reviewed By: pepeiborra

Differential Revision: D56189891

fbshipit-source-id: c1e2882aae78924f6f34d1a224c5bb98b3bbd746
  • Loading branch information
Simon Marlow authored and facebook-github-bot committed Apr 17, 2024
1 parent 3c22d42 commit 7e3a6d6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions glean/glass/Glean/Glass/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,22 @@ class LogRequest a where
logRequest :: a -> GleanGlassLogger

instance LogRequest (DocumentSymbolsRequest, RequestOptions) where
logRequest (d, RequestOptions{..}) = logRequest d <> options
where
options = case requestOptions_revision of
Nothing -> mempty
Just revision -> Logger.setRevision $ unRevision revision
logRequest (d, r) = logRequest d <> logRequest r

instance LogRequest a => LogRequest (Maybe a) where
logRequest = maybe mempty logRequest

instance LogRequest RequestOptions where
logRequest RequestOptions{..} =
maybe mempty (Logger.setRevision . unRevision) requestOptions_revision <>
maybe mempty (Logger.setLimit . fromIntegral) requestOptions_limit <>
Logger.setExactRevision requestOptions_exact_revision <>
logRequest requestOptions_feature_flags

instance LogRequest FeatureFlags where
logRequest FeatureFlags{..} =
maybe mempty Logger.setNearestRevision featureFlags_nearest_revision <>
maybe mempty Logger.setIncludeXlangXrefs featureFlags_include_xlang_refs

instance LogRequest DocumentSymbolsRequest where
logRequest = logDocumentSymbolsRequestSG Logger.setFilepath Logger.setRepo
Expand Down

0 comments on commit 7e3a6d6

Please sign in to comment.