wstunnel/src/Logger.hs
Erèbe cde2afd264 Use default-extensions in cabal
Former-commit-id: bc12a795326740f2f7504c77e6efdd4a633d6a8e
Former-commit-id: 206c1715e5164d8485423905848e545eecb2a220 [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 5ef346e51622358e3e9d4c6e94e348758fac361f [formerly 3d9f6a38a164185f31d5610b045744b79190087b]]]]
Former-commit-id: 73593f34778fd5c5be7436189d48b72fc8699a0e
Former-commit-id: b82bb6c8a4286f6c8b37331cecdd3de699771e90
Former-commit-id: fa5ef7ed8fb050a4fb24f18a5101faa10b72e4a2
Former-commit-id: 11138952c09bf43fccc5dc2dc8625c83b4d3dbdb [formerly 382271cf86238cf125c05867c60c53fef176955a]
Former-commit-id: e452e246198248849d76ee37f0e20a6ce507a855
2016-10-09 20:54:08 +02:00

26 lines
698 B
Haskell

module Logger where
import ClassyPrelude
import Network.Socket (HostName, PortNumber)
import qualified System.Log.Logger as LOG
data Verbosity = QUIET | VERBOSE | NORMAL
init :: Verbosity -> IO ()
init lvl = LOG.updateGlobalLogger "wstunnel" $ case lvl of
QUIET -> LOG.setLevel LOG.ERROR
VERBOSE -> LOG.setLevel LOG.DEBUG
NORMAL -> LOG.setLevel LOG.INFO
toStr :: (HostName, PortNumber) -> String
toStr (host, port) = fromString host <> ":" <> show port
err :: String -> IO()
err msg = LOG.errorM "wstunnel" $ "ERROR :: " <> msg
info :: String -> IO()
info = LOG.infoM "wstunnel"
debug :: String -> IO()
debug msg = LOG.debugM "wstunnel" $ "DEBUG :: " <> msg