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
|
@ -6,6 +6,7 @@
|
|||
-}
|
||||
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Backend.External (makeBackend) where
|
||||
|
||||
|
@ -16,6 +17,7 @@ import Types.Key
|
|||
import Types.Backend
|
||||
import Types.KeySource
|
||||
import Utility.Metered
|
||||
import Utility.Debug
|
||||
import qualified Utility.SimpleProtocol as Proto
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
|
@ -23,7 +25,6 @@ import qualified Data.Map.Strict as M
|
|||
import Data.Char
|
||||
import Control.Concurrent
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import System.Log.Logger (debugM)
|
||||
|
||||
newtype ExternalBackendName = ExternalBackendName S.ByteString
|
||||
deriving (Show, Eq, Ord)
|
||||
|
@ -141,7 +142,7 @@ handleRequest st req whenunavail responsehandler =
|
|||
warning ("external special remote error: " ++ err)
|
||||
whenunavail
|
||||
handleExceptionalMessage loop (DEBUG msg) = do
|
||||
liftIO $ debugM "external" msg
|
||||
liftIO $ debug "Backend.External" msg
|
||||
loop
|
||||
|
||||
withExternalAddon :: ExternalState -> a -> (ExternalAddonProcess -> a) -> a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue