added --debugfilter (and annex.debugfilter)

This commit is contained in:
Joey Hess 2021-04-05 15:21:20 -04:00
parent aaba83795b
commit 1b645e1ace
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 65 additions and 14 deletions

View file

@ -258,13 +258,17 @@ setupConsole = do
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
enableDebugOutput :: IO ()
enableDebugOutput :: Annex ()
enableDebugOutput = do
dd <- debugDisplayer
configureDebug dd (DebugSelector (\_ -> True))
names <- map encodeBS . annexDebugFilter <$> Annex.getGitConfig
let selector
| null names = const True
| otherwise = \(DebugSource s) -> any (`S.isInfixOf` s) names
dd <- liftIO debugDisplayer
liftIO $ configureDebug dd (DebugSelector selector)
disableDebugOutput :: IO ()
disableDebugOutput = do
disableDebugOutput :: Annex ()
disableDebugOutput = liftIO $ do
dd <- debugDisplayer
configureDebug dd (DebugSelector (\_ -> False))