Only use debugLogger when loglevel >= GmDebug
This commit is contained in:
parent
413bac085d
commit
380acdaee0
@ -13,6 +13,10 @@ import Language.Haskell.GhcMod.DebugLogger
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import Prelude
|
||||
|
||||
setEmptyLogger :: DynFlags -> DynFlags
|
||||
setEmptyLogger df =
|
||||
Gap.setLogAction df $ \_ _ _ _ _ -> return ()
|
||||
|
||||
setDebugLogger :: (String -> IO ()) -> DynFlags -> DynFlags
|
||||
setDebugLogger put df = do
|
||||
Gap.setLogAction df (debugLogAction put)
|
||||
|
@ -137,9 +137,13 @@ runGmlTWith efnmns' mdf wrapper action = do
|
||||
(text "Initializing GHC session with following options")
|
||||
(intercalate " " $ map (("\""++) . (++"\"")) opts')
|
||||
|
||||
GhcModLog { gmLogLevel = Just level } <- gmlHistory
|
||||
putErr <- gmErrStrIO
|
||||
let setLogger | level >= GmDebug = setDebugLogger putErr
|
||||
| otherwise = setEmptyLogger
|
||||
|
||||
initSession opts' $
|
||||
setModeSimple >>> setDebugLogger putErr >>> mdf
|
||||
setModeSimple >>> setLogger >>> mdf
|
||||
|
||||
mappedStrs <- getMMappedFilePaths
|
||||
let targetStrs = mappedStrs ++ map moduleNameString mns ++ cfns
|
||||
@ -441,6 +445,9 @@ loadTargets opts targetStrs = do
|
||||
loadTargets' Intelligent
|
||||
else
|
||||
loadTargets' Simple
|
||||
|
||||
gmLog GmDebug "loadTargets" $ text "Loading done"
|
||||
|
||||
where
|
||||
relativize (Target (TargetFile filePath phase) taoc src) = do
|
||||
crdl <- cradle
|
||||
|
Loading…
Reference in New Issue
Block a user