From bac59cece66e97900554fdee394e8f86027a7d25 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 11 Jun 2014 01:29:00 -0400 Subject: 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. --- Assistant/Threads/WebApp.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Assistant') 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 -- cgit v1.2.3