module DPut where import Control.Concurrent.STM import qualified Data.Map.Strict as Map import System.IO (stderr,hPutStrLn) import Data.Maybe import System.IO.Unsafe (unsafePerformIO) import System.Log.Logger data DebugTag = XAnnounce | XDHT | XOnion | XNetCrypto | XPing | XLan | XMisc | XWLog deriving (Eq,Ord,Show,Read,Enum,Bounded) appName :: String appName = "toxmpp" (<.>) :: String -> String -> String a <.> b = a ++ "." ++ b dput :: DebugTag -> String -> IO () dput tag msg = debugM (appName <.> show tag) msg setTagLevel :: Priority -> DebugTag -> IO () setTagLevel level tag = updateGlobalLogger (appName <.> show tag) (setLevel level) setQuiet :: DebugTag -> IO () setQuiet = setTagLevel WARNING setVerbose :: DebugTag -> IO () setVerbose = setTagLevel DEBUG