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:
Joey Hess 2021-04-05 13:40:31 -04:00
parent 19c672e710
commit aaba83795b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
26 changed files with 194 additions and 105 deletions

View file

@ -39,6 +39,7 @@ import Backend.Hash
import Utility.Hash
import Utility.SshHost
import Utility.Url
import Utility.Debug
import Logs.Remote
import Logs.RemoteState
import qualified Git.Config
@ -53,7 +54,6 @@ import Control.Concurrent.STM
import Data.String
import Network.HTTP.Types
import Network.HTTP.Client hiding (port)
import System.Log.Logger
import qualified Data.Map as M
import qualified Data.ByteString.Lazy as L
import qualified Data.Text as T
@ -349,11 +349,11 @@ makeSmallAPIRequest :: Request -> Annex (Response L.ByteString)
makeSmallAPIRequest req = do
uo <- getUrlOptions
let req' = applyRequest uo req
liftIO $ debugM "git-lfs" (show req')
liftIO $ debug "Remote.GitLFS" (show req')
resp <- liftIO $ httpLbs req' (httpManager uo)
-- Only debug the http status code, not the json
-- which may include an authentication token.
liftIO $ debugM "git-lfs" (show $ responseStatus resp)
liftIO $ debug "Remote.GitLFS" (show $ responseStatus resp)
return resp
sendTransferRequest