fix: not logging tx variables and pre-request (#4341)

Addresses the first item on https://github.com/PostgREST/postgrest/issues/3934
This commit is contained in:
Steve Chavez
2025-09-19 12:16:10 -05:00
committed by GitHub
parent 98de226dfd
commit 9f056ac756
6 changed files with 70 additions and 11 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ logWithZTime loggerState txt = do
logMainQ :: LoggerState -> MainQuery -> IO ()
logMainQ loggerState MainQuery{mqOpenAPI=(x, y, z),..} =
let snipts = renderSnippet <$> [mqMain, x, y, z, fromMaybe mempty mqExplain]
let snipts = renderSnippet <$> [mqTxVars, fromMaybe mempty mqPreReq, mqMain, x, y, z, fromMaybe mempty mqExplain]
-- Does not log SQL when it's empty (happens on OPTIONS requests and when the openapi queries are not generated)
logQ q = when (q /= mempty) $ logWithZTime loggerState $ showOnSingleLine '\n' $ T.decodeUtf8 q in
mapM_ logQ snipts