blob: 3cb31160b3c55c76207fece04c5b75d90a4c494b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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
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
|