Skip to content

Commit 4a99559

Browse files
committed
Fix commercialhaskell#5364 Add new LogFunc to environment
The 'SQL' debug log messages take their logging function from the environment, not from the `configRunner` of the `Config`. This proposed change uses a new helper function, `withLocalLogFunc`, to modify that part of the environment.
1 parent 1b1bed5 commit 4a99559

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Stack/Config.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ configFromConfigMonoid
403403

404404
withNewLogFunc go useColor'' stylesUpdate' $ \logFunc -> do
405405
let configRunner = configRunner'' & logFuncL .~ logFunc
406-
withPantryConfig
406+
withLocalLogFunc logFunc $ withPantryConfig
407407
pantryRoot
408408
hsc
409409
(maybe HpackBundled HpackCommand $ getFirst configMonoidOverrideHpack)
@@ -415,6 +415,10 @@ configFromConfigMonoid
415415
(configStackRoot </> relFileStorage)
416416
(\configUserStorage -> inner Config {..}))
417417

418+
-- | Runs the provided action with the given 'LogFunc' in the environment
419+
withLocalLogFunc :: HasLogFunc env => LogFunc -> RIO env a -> RIO env a
420+
withLocalLogFunc logFunc = local (set logFuncL logFunc)
421+
418422
-- | Runs the provided action with a new 'LogFunc', given a 'StylesUpdate'.
419423
withNewLogFunc :: MonadUnliftIO m
420424
=> GlobalOpts

0 commit comments

Comments
 (0)