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:
parent
9200e9a5f9
commit
fa1c1e0f65
7 changed files with 33 additions and 7 deletions
|
@ -18,9 +18,9 @@ import qualified Git
|
||||||
import Config
|
import Config
|
||||||
import Config.Files
|
import Config.Files
|
||||||
import Utility.DataUnits
|
import Utility.DataUnits
|
||||||
|
import Git.Config
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import System.Log.Logger
|
|
||||||
|
|
||||||
data PrefsForm = PrefsForm
|
data PrefsForm = PrefsForm
|
||||||
{ diskReserve :: Text
|
{ diskReserve :: Text
|
||||||
|
@ -68,7 +68,7 @@ getPrefs = PrefsForm
|
||||||
<$> (T.pack . roughSize storageUnits False . annexDiskReserve <$> Annex.getGitConfig)
|
<$> (T.pack . roughSize storageUnits False . annexDiskReserve <$> Annex.getGitConfig)
|
||||||
<*> (annexNumCopies <$> Annex.getGitConfig)
|
<*> (annexNumCopies <$> Annex.getGitConfig)
|
||||||
<*> inAutoStartFile
|
<*> inAutoStartFile
|
||||||
<*> ((==) <$> (pure $ Just DEBUG) <*> (liftIO $ getLevel <$> getRootLogger))
|
<*> (annexDebug <$> Annex.getGitConfig)
|
||||||
|
|
||||||
storePrefs :: PrefsForm -> Annex ()
|
storePrefs :: PrefsForm -> Annex ()
|
||||||
storePrefs p = do
|
storePrefs p = do
|
||||||
|
@ -79,8 +79,10 @@ storePrefs p = do
|
||||||
liftIO $ if autoStart p
|
liftIO $ if autoStart p
|
||||||
then addAutoStartFile here
|
then addAutoStartFile here
|
||||||
else removeAutoStartFile here
|
else removeAutoStartFile here
|
||||||
liftIO $ updateGlobalLogger rootLoggerName $ setLevel $
|
setConfig (annexConfig "debug") (boolConfig $ debugEnabled p)
|
||||||
if debugEnabled p then DEBUG else WARNING
|
liftIO $ if debugEnabled p
|
||||||
|
then enableDebugOutput
|
||||||
|
else disableDebugOutput
|
||||||
|
|
||||||
getPreferencesR :: Handler RepHtml
|
getPreferencesR :: Handler RepHtml
|
||||||
getPreferencesR = postPreferencesR
|
getPreferencesR = postPreferencesR
|
||||||
|
|
|
@ -48,6 +48,8 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
|
||||||
checkfuzzy
|
checkfuzzy
|
||||||
forM_ fields $ uncurry Annex.setField
|
forM_ fields $ uncurry Annex.setField
|
||||||
sequence_ flags
|
sequence_ flags
|
||||||
|
whenM (annexDebug <$> Annex.getGitConfig) $
|
||||||
|
liftIO enableDebugOutput
|
||||||
prepCommand cmd params
|
prepCommand cmd params
|
||||||
tryRun state' cmd $ [startup] ++ actions ++ [shutdown $ cmdnocommit cmd]
|
tryRun state' cmd $ [startup] ++ actions ++ [shutdown $ cmdnocommit cmd]
|
||||||
where
|
where
|
||||||
|
|
10
Messages.hs
10
Messages.hs
|
@ -31,7 +31,9 @@ module Messages (
|
||||||
showCustom,
|
showCustom,
|
||||||
showHeader,
|
showHeader,
|
||||||
showRaw,
|
showRaw,
|
||||||
setupConsole
|
setupConsole,
|
||||||
|
enableDebugOutput,
|
||||||
|
disableDebugOutput
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Text.JSON
|
import Text.JSON
|
||||||
|
@ -220,6 +222,12 @@ setupConsole = do
|
||||||
fileEncoding stdout
|
fileEncoding stdout
|
||||||
fileEncoding stderr
|
fileEncoding stderr
|
||||||
|
|
||||||
|
enableDebugOutput :: IO ()
|
||||||
|
enableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel DEBUG
|
||||||
|
|
||||||
|
disableDebugOutput :: IO ()
|
||||||
|
disableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel NOTICE
|
||||||
|
|
||||||
handle :: IO () -> IO () -> Annex ()
|
handle :: IO () -> IO () -> Annex ()
|
||||||
handle json normal = withOutputType go
|
handle json normal = withOutputType go
|
||||||
where
|
where
|
||||||
|
|
|
@ -16,7 +16,6 @@ module Option (
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Log.Logger
|
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
@ -40,6 +39,8 @@ common =
|
||||||
"enable JSON output"
|
"enable JSON output"
|
||||||
, Option ['d'] ["debug"] (NoArg setdebug)
|
, Option ['d'] ["debug"] (NoArg setdebug)
|
||||||
"show debug messages"
|
"show debug messages"
|
||||||
|
, Option [] ["no-debug"] (NoArg unsetdebug)
|
||||||
|
"don't show debug messages"
|
||||||
, Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
|
, Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
|
||||||
"specify key-value backend to use"
|
"specify key-value backend to use"
|
||||||
]
|
]
|
||||||
|
@ -48,7 +49,8 @@ common =
|
||||||
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
||||||
setauto v = Annex.changeState $ \s -> s { Annex.auto = v }
|
setauto v = Annex.changeState $ \s -> s { Annex.auto = v }
|
||||||
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
||||||
setdebug = liftIO $ updateGlobalLogger rootLoggerName $ setLevel DEBUG
|
setdebug = Annex.changeGitConfig $ \c -> c { annexDebug = True }
|
||||||
|
unsetdebug = Annex.changeGitConfig $ \c -> c { annexDebug = False }
|
||||||
|
|
||||||
matcher :: [Option]
|
matcher :: [Option]
|
||||||
matcher =
|
matcher =
|
||||||
|
|
|
@ -35,6 +35,7 @@ data GitConfig = GitConfig
|
||||||
, annexHttpHeaders :: [String]
|
, annexHttpHeaders :: [String]
|
||||||
, annexHttpHeadersCommand :: Maybe String
|
, annexHttpHeadersCommand :: Maybe String
|
||||||
, annexAutoCommit :: Bool
|
, annexAutoCommit :: Bool
|
||||||
|
, annexDebug :: Bool
|
||||||
, annexWebOptions :: [String]
|
, annexWebOptions :: [String]
|
||||||
, annexWebDownloadCommand :: Maybe String
|
, annexWebDownloadCommand :: Maybe String
|
||||||
, annexCrippledFileSystem :: Bool
|
, annexCrippledFileSystem :: Bool
|
||||||
|
@ -59,6 +60,7 @@ extractGitConfig r = GitConfig
|
||||||
, annexHttpHeaders = getlist (annex "http-headers")
|
, annexHttpHeaders = getlist (annex "http-headers")
|
||||||
, annexHttpHeadersCommand = getmaybe (annex "http-headers-command")
|
, annexHttpHeadersCommand = getmaybe (annex "http-headers-command")
|
||||||
, annexAutoCommit = getbool (annex "autocommit") True
|
, annexAutoCommit = getbool (annex "autocommit") True
|
||||||
|
, annexDebug = getbool (annex "debug") False
|
||||||
, annexWebOptions = getwords (annex "web-options")
|
, annexWebOptions = getwords (annex "web-options")
|
||||||
, annexWebDownloadCommand = getmaybe (annex "web-download-command")
|
, annexWebDownloadCommand = getmaybe (annex "web-download-command")
|
||||||
, annexCrippledFileSystem = getbool (annex "crippledfilesystem") False
|
, annexCrippledFileSystem = getbool (annex "crippledfilesystem") False
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -28,6 +28,8 @@ git-annex (4.20130602) UNRELEASED; urgency=low
|
||||||
area, since it does not keep track of associated files.)
|
area, since it does not keep track of associated files.)
|
||||||
Closes: #712060
|
Closes: #712060
|
||||||
* status: No longer shows dead repositories.
|
* status: No longer shows dead repositories.
|
||||||
|
* annex.debug can now be set to enable debug logging by default.
|
||||||
|
The webapp's debugging check box does this.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 10 Jun 2013 12:52:44 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 10 Jun 2013 12:52:44 -0400
|
||||||
|
|
||||||
|
|
|
@ -622,6 +622,10 @@ subdirectories).
|
||||||
|
|
||||||
Show debug messages.
|
Show debug messages.
|
||||||
|
|
||||||
|
* --no-debug
|
||||||
|
|
||||||
|
Disable debug messages.
|
||||||
|
|
||||||
* --from=repository
|
* --from=repository
|
||||||
|
|
||||||
Specifies a repository that content will be retrieved from, or that
|
Specifies a repository that content will be retrieved from, or that
|
||||||
|
@ -903,6 +907,10 @@ Here are all the supported configuration settings.
|
||||||
Set to false to prevent the git-annex assistant from automatically
|
Set to false to prevent the git-annex assistant from automatically
|
||||||
committing changes to files in the repository.
|
committing changes to files in the repository.
|
||||||
|
|
||||||
|
* `annex.debug`
|
||||||
|
|
||||||
|
Set to true to enable debug logging by default.
|
||||||
|
|
||||||
* `annex.version`
|
* `annex.version`
|
||||||
|
|
||||||
Automatically maintained, and used to automate upgrades between versions.
|
Automatically maintained, and used to automate upgrades between versions.
|
||||||
|
|
Loading…
Reference in a new issue