switch from hslogger to purpose-built Utility.Debug
This uses a DebugSelector, rather than debug levels, which will allow for a later option like --debug-from=Process to only see debuging about running processes. The module name that contains the thing being debugged is used as the DebugSelector (in most cases; does not need to be a hard and fast rule). Debug calls were changed to add that. hslogger did not display that first parameter to debugM, but the DebugSelector does get displayed. Also fastDebug will allow doing debugging in places that are used in tight loops, with the DebugSelector coming from the Annex Reader essentially for free. Not done yet.
This commit is contained in:
parent
19c672e710
commit
aaba83795b
26 changed files with 194 additions and 105 deletions
|
@ -5,6 +5,8 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Command.Drop where
|
||||
|
||||
import Command
|
||||
|
@ -18,8 +20,8 @@ import Annex.NumCopies
|
|||
import Annex.Content
|
||||
import Annex.Wanted
|
||||
import Annex.Notification
|
||||
import Utility.Debug
|
||||
|
||||
import System.Log.Logger (debugM)
|
||||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
|
@ -113,7 +115,7 @@ performLocal key afile numcopies mincopies preverified = lockContentForRemoval k
|
|||
(tocheck, verified) <- verifiableCopies key [u]
|
||||
doDrop u (Just contentlock) key afile numcopies mincopies [] (preverified ++ verified) tocheck
|
||||
( \proof -> do
|
||||
liftIO $ debugM "drop" $ unwords
|
||||
liftIO $ debug "Command.Drop" $ unwords
|
||||
[ "Dropping from here"
|
||||
, "proof:"
|
||||
, show proof
|
||||
|
@ -140,7 +142,7 @@ performRemote key afile numcopies mincopies remote = do
|
|||
(tocheck, verified) <- verifiableCopies key [uuid]
|
||||
doDrop uuid Nothing key afile numcopies mincopies [uuid] verified tocheck
|
||||
( \proof -> do
|
||||
liftIO $ debugM "drop" $ unwords
|
||||
liftIO $ debug "Command.Drop" $ unwords
|
||||
[ "Dropping from remote"
|
||||
, show remote
|
||||
, "proof:"
|
||||
|
|
|
@ -20,7 +20,6 @@ import Data.Time.Format
|
|||
import Data.Time.Calendar
|
||||
import Data.Time.LocalTime
|
||||
import qualified Data.Text as T
|
||||
import System.Log.Logger
|
||||
import Control.Concurrent.Async
|
||||
import qualified System.FilePath.ByteString as P
|
||||
|
||||
|
@ -50,6 +49,7 @@ import qualified Git.Ref
|
|||
import qualified Annex.Branch
|
||||
import Logs
|
||||
import Git.CatFile (catObjectStream)
|
||||
import Utility.Debug
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
|
@ -96,7 +96,7 @@ getFeed addunlockedmatcher opts cache url = do
|
|||
)
|
||||
where
|
||||
debugfeedcontent feedcontent msg = do
|
||||
liftIO $ debugM "feed content" $ unlines
|
||||
liftIO $ debug "Command.ImportFeed" $ unlines
|
||||
[ "start of feed content"
|
||||
, feedcontent
|
||||
, "end of feed content"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Command.Move where
|
||||
|
||||
import Command
|
||||
|
@ -18,8 +20,8 @@ import Logs.Presence
|
|||
import Logs.Trust
|
||||
import Logs.File
|
||||
import Annex.NumCopies
|
||||
import Utility.Debug
|
||||
|
||||
import System.Log.Logger (debugM)
|
||||
import qualified Data.ByteString.Char8 as B8
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
||||
|
@ -175,7 +177,7 @@ toPerform dest removewhen key afile fastcheck isthere = do
|
|||
DropWorse -> faileddrophere setpresentremote
|
||||
showproof proof = "proof: " ++ show proof
|
||||
drophere setpresentremote contentlock reason = do
|
||||
liftIO $ debugM "move" $ unwords
|
||||
liftIO $ debug "Command.Move" $ unwords
|
||||
[ "Dropping from here"
|
||||
, "(" ++ reason ++ ")"
|
||||
]
|
||||
|
@ -255,7 +257,7 @@ fromPerform src removewhen key afile = do
|
|||
showproof proof = "proof: " ++ show proof
|
||||
|
||||
dropremote reason = do
|
||||
liftIO $ debugM "move" $ unwords
|
||||
liftIO $ debug "Command.Move" $ unwords
|
||||
[ "Dropping from remote"
|
||||
, show src
|
||||
, "(" ++ reason ++ ")"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Command.SendKey where
|
||||
|
||||
import Command
|
||||
|
@ -14,8 +16,7 @@ import Utility.Rsync
|
|||
import Annex.Transfer
|
||||
import qualified CmdLine.GitAnnexShell.Fields as Fields
|
||||
import Utility.Metered
|
||||
|
||||
import System.Log.Logger
|
||||
import Utility.Debug
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $
|
||||
|
@ -45,14 +46,14 @@ start (_, key) = do
|
|||
|
||||
fieldTransfer :: Direction -> Key -> (MeterUpdate -> Annex Bool) -> CommandStart
|
||||
fieldTransfer direction key a = do
|
||||
liftIO $ debugM "fieldTransfer" "transfer start"
|
||||
liftIO $ debug "Command.SendKey" "transfer start"
|
||||
afile <- AssociatedFile . (fmap toRawFilePath)
|
||||
<$> Fields.getField Fields.associatedFile
|
||||
ok <- maybe (a $ const noop)
|
||||
-- Using noRetry here because we're the sender.
|
||||
(\u -> runner (Transfer direction (toUUID u) (fromKey id key)) afile Nothing noRetry a)
|
||||
=<< Fields.getField Fields.remoteUUID
|
||||
liftIO $ debugM "fieldTransfer" "transfer done"
|
||||
liftIO $ debug "Command.SendKey" "transfer done"
|
||||
liftIO $ exitBool ok
|
||||
where
|
||||
{- Allow the key to be sent to the remote even if there seems to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue