annex.debug can now be set to enable debug logging by default. The webapp's debugging check box does this.

This commit is contained in:
Joey Hess 2013-06-17 20:41:17 -04:00
parent 9200e9a5f9
commit fa1c1e0f65
7 changed files with 33 additions and 7 deletions

View file

@ -18,9 +18,9 @@ import qualified Git
import Config
import Config.Files
import Utility.DataUnits
import Git.Config
import qualified Data.Text as T
import System.Log.Logger
data PrefsForm = PrefsForm
{ diskReserve :: Text
@ -68,7 +68,7 @@ getPrefs = PrefsForm
<$> (T.pack . roughSize storageUnits False . annexDiskReserve <$> Annex.getGitConfig)
<*> (annexNumCopies <$> Annex.getGitConfig)
<*> inAutoStartFile
<*> ((==) <$> (pure $ Just DEBUG) <*> (liftIO $ getLevel <$> getRootLogger))
<*> (annexDebug <$> Annex.getGitConfig)
storePrefs :: PrefsForm -> Annex ()
storePrefs p = do
@ -79,8 +79,10 @@ storePrefs p = do
liftIO $ if autoStart p
then addAutoStartFile here
else removeAutoStartFile here
liftIO $ updateGlobalLogger rootLoggerName $ setLevel $
if debugEnabled p then DEBUG else WARNING
setConfig (annexConfig "debug") (boolConfig $ debugEnabled p)
liftIO $ if debugEnabled p
then enableDebugOutput
else disableDebugOutput
getPreferencesR :: Handler RepHtml
getPreferencesR = postPreferencesR