diff options
Diffstat (limited to 'main/Main.hs')
| -rw-r--r-- | main/Main.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/main/Main.hs b/main/Main.hs index 8dee414..c24e471 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -70,6 +70,7 @@ data Options = Options , optChatroomAutoSubscribe :: Maybe Int , optDmBotEcho :: Maybe Text , optWebSocketServer :: Maybe Int + , optWebSocketDebugLog :: Bool , optShowHelp :: Bool , optShowVersion :: Bool } @@ -95,6 +96,7 @@ defaultOptions = Options , optChatroomAutoSubscribe = Nothing , optDmBotEcho = Nothing , optWebSocketServer = Nothing + , optWebSocketDebugLog = False , optShowHelp = False , optShowVersion = False } @@ -209,6 +211,9 @@ debugOptions = [ Option [] [ "discovery-debug-log" ] (NoArg (serviceAttr $ \attrs -> return attrs { discoveryDebugLog = True })) "" + , Option [] [ "websocket-debug-log" ] + (NoArg (\opts -> return opts { optWebSocketDebugLog = True })) + "" ] where updateService :: (Service s, Monad m, Typeable m) => (ServiceAttributes s -> m (ServiceAttributes s)) -> SomeService -> m SomeService @@ -460,7 +465,10 @@ interactiveLoop st opts = withTerminal commandCompletion $ \term -> do map soptService $ filter soptEnabled $ optServices opts case optWebSocketServer opts of - Just port -> startWebsocketServer server "::" port (extPrintLn . plainText . T.pack) + Just port -> startWebsocketServer server (extPrintLn . plainText . T.pack) defaultWebSocketOptions + { wsPort = port + , wsDebugLog = optWebSocketDebugLog opts + } Nothing -> return () void $ liftIO $ forkIO $ void $ forever $ do |