summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine.hs2
-rw-r--r--Messages.hs10
-rw-r--r--Option.hs6
-rw-r--r--Types/GitConfig.hs2
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn8
6 files changed, 27 insertions, 3 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 8f4c99269..d9a410369 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -48,6 +48,8 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
checkfuzzy
forM_ fields $ uncurry Annex.setField
sequence_ flags
+ whenM (annexDebug <$> Annex.getGitConfig) $
+ liftIO enableDebugOutput
prepCommand cmd params
tryRun state' cmd $ [startup] ++ actions ++ [shutdown $ cmdnocommit cmd]
where
diff --git a/Messages.hs b/Messages.hs
index b2fcba881..0357da12d 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -31,7 +31,9 @@ module Messages (
showCustom,
showHeader,
showRaw,
- setupConsole
+ setupConsole,
+ enableDebugOutput,
+ disableDebugOutput
) where
import Text.JSON
@@ -220,6 +222,12 @@ setupConsole = do
fileEncoding stdout
fileEncoding stderr
+enableDebugOutput :: IO ()
+enableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel DEBUG
+
+disableDebugOutput :: IO ()
+disableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel NOTICE
+
handle :: IO () -> IO () -> Annex ()
handle json normal = withOutputType go
where
diff --git a/Option.hs b/Option.hs
index d59af43c7..64ba56f6d 100644
--- a/Option.hs
+++ b/Option.hs
@@ -16,7 +16,6 @@ module Option (
) where
import System.Console.GetOpt
-import System.Log.Logger
import Common.Annex
import qualified Annex
@@ -40,6 +39,8 @@ common =
"enable JSON output"
, Option ['d'] ["debug"] (NoArg setdebug)
"show debug messages"
+ , Option [] ["no-debug"] (NoArg unsetdebug)
+ "don't show debug messages"
, Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
"specify key-value backend to use"
]
@@ -48,7 +49,8 @@ common =
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
setauto v = Annex.changeState $ \s -> s { Annex.auto = 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 =
diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs
index 888795cbb..d5d234ca9 100644
--- a/Types/GitConfig.hs
+++ b/Types/GitConfig.hs
@@ -35,6 +35,7 @@ data GitConfig = GitConfig
, annexHttpHeaders :: [String]
, annexHttpHeadersCommand :: Maybe String
, annexAutoCommit :: Bool
+ , annexDebug :: Bool
, annexWebOptions :: [String]
, annexWebDownloadCommand :: Maybe String
, annexCrippledFileSystem :: Bool
@@ -59,6 +60,7 @@ extractGitConfig r = GitConfig
, annexHttpHeaders = getlist (annex "http-headers")
, annexHttpHeadersCommand = getmaybe (annex "http-headers-command")
, annexAutoCommit = getbool (annex "autocommit") True
+ , annexDebug = getbool (annex "debug") False
, annexWebOptions = getwords (annex "web-options")
, annexWebDownloadCommand = getmaybe (annex "web-download-command")
, annexCrippledFileSystem = getbool (annex "crippledfilesystem") False
diff --git a/debian/changelog b/debian/changelog
index e51c769c3..c433d2bf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,8 @@ git-annex (4.20130602) UNRELEASED; urgency=low
area, since it does not keep track of associated files.)
Closes: #712060
* 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
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 18bc05ad2..f0da25e14 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -622,6 +622,10 @@ subdirectories).
Show debug messages.
+* --no-debug
+
+ Disable debug messages.
+
* --from=repository
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
committing changes to files in the repository.
+* `annex.debug`
+
+ Set to true to enable debug logging by default.
+
* `annex.version`
Automatically maintained, and used to automate upgrades between versions.