Maj Logger
Former-commit-id: 4f92bde65f99832c5ae24ae6698c211e9f2bde18 Former-commit-id: f12ba4b2900a22043fe76735c912ae3fa205fe21 [formerly 24f48bf30c121d1466cfe329678f3620c1a77696 [formerly 24f48bf30c121d1466cfe329678f3620c1a77696 [formerly 24f48bf30c121d1466cfe329678f3620c1a77696 [formerly 9aeb97ec347b0a65a85f75b6d0ed93e3bd54dd53]]]] Former-commit-id: 1cb3fa8c9a953dedecb7d66c94cf914312b71a77 Former-commit-id: 092df44e5d7a9a560eadb4f186a77010df215837 Former-commit-id: 2f0d76ad50d96c6477564249b5b7cba9b84d0f33 Former-commit-id: a393fbcadcf6baa7515c5dfb2d7b1a3eb2cec58b [formerly c64d29b4305ce9be62bc46030750f8a627304d95] Former-commit-id: 2cd463763ae087b60e2008ca9e2aaa26284e8a42
This commit is contained in:
parent
1f923c4943
commit
81fa4969ce
2 changed files with 13 additions and 6 deletions
11
app/Main.hs
11
app/Main.hs
|
@ -10,8 +10,8 @@ import qualified Data.ByteString.Char8 as BC
|
|||
import Data.Maybe (fromMaybe)
|
||||
import System.Console.CmdArgs
|
||||
import System.Environment (getArgs, withArgs)
|
||||
import qualified System.Log.Logger as LOG
|
||||
|
||||
import qualified Logger
|
||||
import Tunnel
|
||||
import Types
|
||||
|
||||
|
@ -124,11 +124,10 @@ main = do
|
|||
cfg <- if null args then withArgs ["--help"] (cmdArgs cmdLine) else cmdArgs cmdLine
|
||||
|
||||
let serverInfo = parseServerInfo (WsServerInfo False "" 0) (wsTunnelServer cfg)
|
||||
LOG.updateGlobalLogger "wstunnel" (if quiet cfg
|
||||
then LOG.setLevel LOG.ERROR
|
||||
else if verbose cfg
|
||||
then LOG.setLevel LOG.DEBUG
|
||||
else LOG.setLevel LOG.INFO)
|
||||
Logger.init (if quiet cfg then Logger.QUIET
|
||||
else if verbose cfg
|
||||
then Logger.VERBOSE
|
||||
else Logger.NORMAL)
|
||||
|
||||
|
||||
if serverMode cfg
|
||||
|
|
|
@ -7,6 +7,14 @@ 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue