summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-11 01:29:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-11 01:29:00 -0400
commitbac59cece66e97900554fdee394e8f86027a7d25 (patch)
tree211aabe948cb827ad10b2752865ec1a51ca1def9 /Assistant
parentf9e7c320eea31ce3cbec647e295d375ac09b7d82 (diff)
Fix build with wai 0.3.0.
This version of wai changed the type of Middleware, so I cannot seem to liftIO inside it. So, got rid of a lot of not really needed complexity to use System.Log.Logger's logging stuff, and just use the standard wai stdout logger when debug logging is enabled. Format may change some, and it logs http to stdout instead of stderr now. Doesn't matter for the webapp since both go to the same log anyway.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/WebApp.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs
index 8d977194b..416c07874 100644
--- a/Assistant/Threads/WebApp.hs
+++ b/Assistant/Threads/WebApp.hs
@@ -47,6 +47,8 @@ import Yesod
import Network.Socket (SockAddr, HostName)
import Data.Text (pack, unpack)
import qualified Network.Wai.Handler.WarpTLS as TLS
+import Network.Wai.Middleware.RequestLogger
+import System.Log.Logger
mkYesodDispatch "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
@@ -83,7 +85,7 @@ webAppThread assistantdata urlrenderer noannex cannotrun postfirstrun listenhost
setUrlRenderer urlrenderer $ yesodRender webapp (pack "")
app <- toWaiAppPlain webapp
app' <- ifM debugEnabled
- ( return $ httpDebugLogger app
+ ( return $ logStdout app
, return app
)
runWebApp tlssettings listenhost' app' $ \addr -> if noannex
@@ -135,3 +137,9 @@ getTlsSettings = do
#else
return Nothing
#endif
+
+{- Checks if debugging is actually enabled. -}
+debugEnabled :: IO Bool
+debugEnabled = do
+ l <- getRootLogger
+ return $ getLevel l <= Just DEBUG